• 努力了解实体框架和生成的dmx文档。
在我的解决办法中增加一个x子文档的同时,增加了以下部分:
<add name="MyEntities" connectionString="metadata=res://*/Model.MyModel.csdl|
res://*/Model.MyModel.ssdl|
res://*/Model.MyModel.msl;provider=System.Data.SqlClient;provider connection
string="Server=xxx;Database=mydb;
UserID=xxxx;Password=xx;Trusted_Connection=False;Encrypt=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
Everything works fine until I need to delete the edmx and re-add it. Leaving the above config section intact AND choosing to skip the "Save entity connection settings in web.config as: MyEntities" causes issues.
The solution no longer recognizes my object context - MyEntities. It gives me a generic "Entities" instead. I check the designer.cs file and it sure enough its peppered with Entities instead of MyEntities. Would be great if someone could throw some light on how this mapping works and how everytime I delete and re-add the same edmx I would not have to edit the config file.