Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Entity Framework Perplexities
Message
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Network:
Windows Server 2012
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01646424
Message ID:
01646533
Views:
27
>You could :
   public partial class PluczExp_PluczContext  : DbContext
>    {
>        public PluczExp_PluczContext (): base("name=PluczExpEntities") {}
>
>        public PluczExp_PluczContext (string ConnectionName): base("name="+ConnectionName) {}
>    }
so instantiating the context with an empty constructor would use the "PluczExpEntities" connection name in app.config and instantiating with
PluczExp_PluczContext  PGD = new PluczExp_PluczContext ("PluczExpEntities2");
would use the connection named 'PluczExpEntities2'. In app.config just copy the default, rename and adjust.

Yes. I got it to work to what I want.

What did not work is that I created a partial class (containing the constructor with one parameter) in a different assembly.

But I created that partial class (containing the constructor with one parameter) in the same assembly as the one generated by EF. Even if I regenerate the EF stuff, that class should not be affected.

Thanks for your help.

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Reply
Map
View

Click here to load this message in the networking platform