edml model settings problems

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
CodeSlinger
Posts: 31
Joined: Mon 04 May 2015 18:49

edml model settings problems

Post by CodeSlinger » Thu 16 Jul 2015 16:59

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

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: edml model settings problems

Post by Shalex » Fri 17 Jul 2015 17:45

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"!
Actually Entity Developer saves connection settings in app.config of Startup Project and uses that connection string.
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,
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: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!
Update Model From Database doesn't use local app.config. It reads connection string from the *.edps file of the model.

CodeSlinger
Posts: 31
Joined: Mon 04 May 2015 18:49

Re: edml model settings problems

Post by CodeSlinger » Mon 20 Jul 2015 13:37

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

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: edml model settings problems

Post by Shalex » Tue 21 Jul 2015 13:28

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.
Thank you for the suggestion.
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.
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.

Post Reply