English 中文(简体)
B. 实体框架
原标题:entity framework reusing edmx entity connection string

• 努力了解实体框架和生成的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=&quot;Server=xxx;Database=mydb;
UserID=xxxx;Password=xx;Trusted_Connection=False;Encrypt=True;multipleactiveresultsets=True;App=EntityFramework&quot;" 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.

问题回答

此前,你读过了dmx文档,只是删除了(或支持其他地方的)斜线;从汇卷宗中删除了部分,以重新使用连接名称。





相关问题
ASP.NET MVC Web Config Email Settings

I m trying to include some SMTP settings in my ASP.NET MVC project by adding the following to my Web.Config file: <system.net> <mailSettings> <smtp> <network ...

change web.config settings in code behind

i m using a third party upload control and there r few settings in web.config <uploadSettings allowedFileExtensions=".pdf,.xls,.doc,.zip,.rar,.jpg" scriptPath="upload_scripts" imagePath="" cssPath=...

WebForms and ASP.NET MVC co-existence

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I ve done to make that happen is that I added a namespaces node to the WebForms web.config: <pages ...

热门标签