none
Entity Framework 4.3.1 and ConfigSource RRS feed

  • Question

  • Working Database First, not using Migrations.

    Have found that unless the connectionstring exists in the App.Config, the Entity Framework designer does not populate the connectstring entry in the properties block. Any attempt to refresh from database results in a new connectionstring build request being made.

    Anyone got any ideas?

    thanks.

    Wednesday, June 27, 2012 12:04 PM

All replies

  • Hi ScottishYorkshireMan,

    Welcome to MSDN Forum.

    When an edmx file is created, the connection string will exist in app.config file. Could you please clarify the scenario more detailed? This is, so I can help you more effectively.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, June 28, 2012 2:45 AM
    Moderator
  • Allen,

    Apologies, now I look back upon my message I see what I have omitted. Sometimes you can be too close to a problem.

    I was using an external config file, that was duly addressed by the configSource directive. This was working fine for general development but it seems that the Entity Framework Designer, can not function unless the connectionstring is actually in the app.config. If an external config file is used, the connectstring is blank in the designer.

    We have a requirement to encrypt a number of athentication items in the connectionstring, this is working well with the exception that access to the Entity Framework designer isn't possible. I found another thread where it stated that connectionstrings were copied to a path under the users own data area. The suggestion here was that some corruption may have occurred, so I have been down the path of devenv /resetuserdata but this hasn't resolved the problem.

    I hope this provides you with sufficient information.

    For the record, my machine has both VS2010 and VS2012 RC.

    kind regards

    SYM

    Thursday, June 28, 2012 6:48 AM
  • Hi ScottishYorkshireMan,

    My understanding is the config file and the edm designer are in different project, is it correct? Commonly, we will not delete the app.config file, if another project need to use the edm file, we will copy the connection string from the app.config to the target project's configuration file. But I find you said you don't want to do that. OK, I will do more rearch on this issue and come back as soon as possible. Thanks for your understanding.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Friday, June 29, 2012 9:26 AM
    Moderator
  • Allen,

    Thanks for the response. The App.Config and the edm model are all in the same project.

    In my app.config I have a connectionstrings section that when I use the configSource directive to point to another file for the connectionstring, I cannot undertaken ANY modifications to the edm model. When the designer appears, in the properties the ConnectionString is blank. This is ONLY restored by placing the connectionstring entry BACK into the app.config and then removing the configSource.

    I am having to place the connectionstring into a separate file simply because of my clients requirement for encryption of the authentication elements of the connectionstring.

    I hope this makes it clearer.

    thanks in advance

    SYM.

    Friday, June 29, 2012 10:21 AM
  • Hi ScottishYorkshireMan,

    I have tested. After adding the edmx file, i removed the section of connection string to another confuration file, and using configsource to locate it. The connection string is empty in properties window. But, the project works well, no exception throws.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 2, 2012 7:05 AM
    Moderator
  • Allen,

    Many thanks for looking into this, it really is appreciated.

    Now yes, my app runs fine too. However, can you now go to the entity designer, and try updating from the database?

    The problem I experienced here is that the connectionbuilder dialog will appear, asking for a connection to be made, suggesting that the EF designer doesn't find a connectionstring when it is in a file that is pointed to by a configsource entry.

    Can you concur the same action?

    thanks

    SYM.

    Monday, July 2, 2012 7:54 AM
  • Hi ScottishYorkshireMan,

    Yes, the designer will not recognize the connection string. Because when we use ConfigSource, the content of the alternative configuration file will be accessed at runtime, so the designer couldn't recognize it. : )

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, July 3, 2012 3:04 AM
    Moderator
  • Hi ScottishYorkshireMan,

    Any update abuot this issue? If you need further help, please feel free to let me know. I will be more than happy to be of assistance. :)

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Friday, July 6, 2012 2:37 AM
    Moderator
  • Allen,

    Apologies, it seems the update I replied with for some reason never made it.

    Surely then this action by the designer renders the use of configsource with Entity Framework somewhat pointless, given that to take advantage of it, you have to add in a connectionstring and remove the configsource attribute in order to be able to maintain your model?

    I am glad in a way this isn't a problem on my machine alone, however I do believe this should be addressed accordingly.

    I do however appreciate your help in looking into this, and unless any kind of correction can be made the issue is now closed.

    regards

    SYM


    Friday, July 6, 2012 8:17 AM
  • Hi ScottishYorkshireMan,

    Thanks for your feedback, I will consult the Product Team to make sure whether this is by design and come back when I receive the feedback. : )

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 9, 2012 5:19 AM
    Moderator
  • Hi,

    Any news about this? Stille the same issue in EF 6.

    Kind regards


    Immobilis

    Sunday, February 9, 2014 9:59 PM
  • This is causing me problems too, why cant the designer use the separate configSource instead of prompting for a new connectionstring every time.

    I don't store the separate configsource files in tfs to allow source branches to connect to different DB's without causing developers a nightmare on merging and having to ignore them.

    Has anyone found a work around or are Microsoft looking to solve this problem?

    Regards


    zac

    Monday, February 10, 2014 4:36 PM
  • I have similar issue,is there any solution to store entityframework settings in another config file with user configSource or something like that
    Monday, September 17, 2018 11:32 AM