ConnectionString - issue with .NET Core 2.0

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
RobertK
Posts: 111
Joined: Thu 02 Mar 2017 05:44

ConnectionString - issue with .NET Core 2.0

Post by RobertK » Mon 27 Nov 2017 23:35

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.

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

Re: ConnectionString - issue with .NET Core 2.0

Post by Shalex » Thu 30 Nov 2017 14:10

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.

RobertK
Posts: 111
Joined: Thu 02 Mar 2017 05:44

Re: ConnectionString - issue with .NET Core 2.0

Post by RobertK » Fri 01 Dec 2017 03:35

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

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

Re: ConnectionString - issue with .NET Core 2.0

Post by Shalex » Fri 01 Dec 2017 18:14

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.

Post Reply