Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Entity Framework Perplexities
Message
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Network:
Windows Server 2012
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01646424
Message ID:
01646533
Vues:
28
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform