I'm building a MVC application and I'm using Entity Framework Code First. I have a Project.Web that containes my MVC files.
I also have another project named Project.Data that contains my context as follows :
public DataModel()
: base("name=DataModel")
{
}
public DbSet<DeploymentStatusReport> DeploymentStatusReports { get; set; }
And I have my data objects in another class within thie project which look like this:
[Table("DeploymentStatusReport")]
public class DeploymentStatusReport
{
[Display(Name = "Release Name")]
[Required]
public string ReleaseName { get; set; }
[DataType(DataType.Date)]
[Display(Name = "Created Date")]
public DateTime CreatedDate { get; set; }
[DataType(DataType.Date)]
[Display(Name = "Sent Date")]
public DateTime SentDate { get; set; }
public string Type { get; set; }
public string Status { get; set; }
}
I have my connection string in both "Project.Web > web.config" and "Project.Data > App.config", Which I don't know if I need it in web.config or not. Because I want my Project.Data to take care of Data Connections. Not the Web.
I Also have my reference CopyToLocal set to true. (The reference I have to Project.Data in Project.Web)
But still when I want to add a controller based on my object it says it's unable to retrieve metadata. :( :
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Any idea ? I got stuck :(