VS2012 Entity Framework Error - Unable to load the specified metadata resource

假如想象 提交于 2019-12-11 22:24:30

问题


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

来源:https://stackoverflow.com/questions/19100804/vs2012-entity-framework-error-unable-to-load-the-specified-metadata-resource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!