0

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 :(

Pouyan
  • 2,849
  • 8
  • 33
  • 39
  • Check your EF connection string in the app and web configs. The EF metadata is stored in a separate file which is then referenced via the entity connection string. These metadata files are usually csdl, ssdl, msl files. – Brad C May 28 '15 at 16:02

1 Answers1

0

remove the entity framework and re add it , you have started off with a new version , delete it using nu get or package manger and remove it from the web config

then re-add the framework

wesley7
  • 101
  • 3