I see two problems with Model Settings -
1. "Save connection settings in App.Config as" does NOT save the settings in app.config but rather it changes the DbContext constructor to use the name= parameter instead of the metadata= parameter. It should be called "Use connection settings in App.Config"!
2. Sub option "Rewrite connection string during regeneration" does NOT modify the app.config file in the project with the edml file as I was told, but rather it modifies the Startup Project. This is dangerous since many folks have different connection strings in different projects, some projects do not have connection strings even, and the ONLY project that is Ok to modify app.config is the project that contains the edml file since that app.config is only used to update model from database and not for running production code!
I feel both of these issues need to be fixed. Thanks, Dave
edml model settings problems
Re: edml model settings problems
Actually Entity Developer saves connection settings in app.config of Startup Project and uses that connection string.CodeSlinger wrote:1. "Save connection settings in App.Config as" does NOT save the settings in app.config but rather it changes the DbContext constructor to use the name= parameter instead of the metadata= parameter. It should be called "Use connection settings in App.Config"!
Please clear selection of "Save connection settings in App.Config as" to avoid writing connection string in app.config of your Startup Project.CodeSlinger wrote:2. Sub option "Rewrite connection string during regeneration" does NOT modify the app.config file in the project with the edml file as I was told, but rather it modifies the Startup Project. This is dangerous since many folks have different connection strings in different projects, some projects do not have connection strings even,
Update Model From Database doesn't use local app.config. It reads connection string from the *.edps file of the model.CodeSlinger wrote:and the ONLY project that is Ok to modify app.config is the project that contains the edml file since that app.config is only used to update model from database and not for running production code!
-
- Posts: 31
- Joined: Mon 04 May 2015 18:49
Re: edml model settings problems
1. Point was that checking that "Save connection settings in app.config" check box does not rewrite the connection string, it only modifies the DbContext constructor to use it or not. It is the second "Rewrite" check box that saves the connection string. The "Save" box would be more clearly labeled "Use the connection string from app.config" as it alone does not save anything.
2. Personally I don't think it is very useful to update the connection string in the startup project since that project may not even use Entity Framework, and there are often other projects that likely do need the connection string. At least it would be more clear to say it updates in app.config of the startup project.
Thanks, Dave
2. Personally I don't think it is very useful to update the connection string in the startup project since that project may not even use Entity Framework, and there are often other projects that likely do need the connection string. At least it would be more clear to say it updates in app.config of the startup project.
Thanks, Dave
Re: edml model settings problems
Thank you for the suggestion.CodeSlinger wrote:1. Point was that checking that "Save connection settings in app.config" check box does not rewrite the connection string, it only modifies the DbContext constructor to use it or not. It is the second "Rewrite" check box that saves the connection string. The "Save" box would be more clearly labeled "Use the connection string from app.config" as it alone does not save anything.
The only app.config from solution used in runtime is the one from Startup Project. Please refer to this discussion: http://stackoverflow.com/questions/1555 ... t-projects.CodeSlinger wrote:2. Personally I don't think it is very useful to update the connection string in the startup project since that project may not even use Entity Framework, and there are often other projects that likely do need the connection string. At least it would be more clear to say it updates in app.config of the startup project.