VS2012 Entity Framework Error - Unable to load the

2019-09-18 08:06发布

I am using VS2012. When I go an create a .edmx file, it creates the following structure:

->Model.edmx
-->Model.Context.tt
-->Model.Designercs
-->Model.edmx.diagram
-->Model.tt

From my understanding, VS2012 generates T4 templates (the .tt files) which generate the entities and context. The default entities generated in VS2012 are POCO entities.

I am able to add a table to the Model just fine.

When I do a compile, I get no errors.

When

I do the following:

    Model dbContext3 = new Model(); 

    var result = (from dd in dbContext3.tblWMt
                  select dd).ToList();

I get the following message at run time from System.Data.MetadataException :

   {"Unable to load the specified metadata resource."}

Any idea what may be going wrong. I did check the connection string and that looks correct. As mentioned, I was able to even add a table from the designer just fine.

Below is the connection string:

   metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="data source=.\Sql2012;initial catalog=Phig;persist security info=True;user id=sa;password=S4343;multipleactiveresultsets=True;application name=EntityFramework

0条回答
登录 后发表回答