Page 1 of 1

ConnectionString - issue with .NET Core 2.0

Posted: Mon 27 Nov 2017 23:35
by RobertK
When you check the box "Use the following connection from App.Config" (under model settings).

The following statement is generated in the context file

Code: Select all

        private static string GetConnectionString(string connectionStringName)
        {
            System.Configuration.ConnectionStringSettings connectionStringSettings = System.Configuration.ConfigurationManager.ConnectionStrings[connectionStringName];
            if (connectionStringSettings == null)
                throw new InvalidOperationException("Connection string \"" + connectionStringName +"\" could not be found in the configuration file.");
            return connectionStringSettings.ConnectionString;
        }
There is an issue with "System.Configuration.ConnectionStringSettings" this method is missing, it has been forwarded to ConfigurationManager.

Re: ConnectionString - issue with .NET Core 2.0

Posted: Thu 30 Nov 2017 14:10
by Shalex
1. Are you using a standalone Entity Developer or the one embedded in your Visual Studio?

2. Is Target framework of your project ".NET Framework" or ".NET Core" or ".NET Standard"?

In case of ".NET Framework", make sure that your project includes a reference to System.Configuration.dll.

Re: ConnectionString - issue with .NET Core 2.0

Posted: Fri 01 Dec 2017 03:35
by RobertK
Shalex wrote:1. Are you using a standalone Entity Developer or the one embedded in your Visual Studio?
standalone Entity Developer
Shalex wrote:1. Are you using a standalone Entity Developer or the one embedded in your Visual Studio?
2. Is Target framework of your project ".NET Framework" or ".NET Core" or ".NET Standard"?
.NET Core
Shalex wrote:In case of ".NET Framework", make sure that your project includes a reference to System.Configuration.dll.
Using .NET Core

Re: ConnectionString - issue with .NET Core 2.0

Posted: Fri 01 Dec 2017 18:14
by Shalex
A standalone Entity Developer generates code for .NET Framework.

Please use Entity Developer embedded in Visual Studio, in this case it will generate the code depending on target framework of your Visual Studio project.