I've created a Model using Model first and Entity Data Model of Entity Framework. Well, when I want to create the controller (right click on controllers folder Add->controller->WebApi 2 Controller with actions using EF) then I become after defining the inputfields an error message: there was an error getting the type "WebApi.Models.QR_Name". Try rebuilding the project. The same error getting by the other Model class. How can I solve this??
EDIT:
I have two classes: //Group
namespace WebApi.Models
{
public partial class QR_Group
{
public QR_Group()
{
this.QR_Name = new HashSet<QR_Name>();
}
public int Id { get; set; }
public string name { get; set; }
public string code { get; set; }
public virtual ICollection<QR_Name> QR_Name { get; set; }
}
}
//Name
namespace WebApi.Models
{
public partial class QR_Name
{
public int Id { get; set; }
public string firstname { get; set; }
public double maxAge { get; set; }
public int QR_GroupId { get; set; }
public virtual QR_Group QR_Group { get; set; }
}
}
Additionally is here the Context class:
namespace WebApi.Models
{
public partial class WebApiContext : DbContext
{
public WebApiContext()
: base("name=WebApiContext")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<QR_Group> QR_Groups { get; set; }
public virtual DbSet<QR_Name> QR_Names { get; set; }
}
}