- installer le package Microsoft.EntityFrameworkCore.Proxies
- dans le dbcontext
private readonly string _connexionString;
public SqlServerContext(string connexionString)
{
_connexionString = connexionString;
}
- dans le dbcontext.OnConfiguring
string myConnectionString = "data source=(LocalDB)\\MSSQLLocalDB;attachdbfilename=C:\\ADI\\DEV_LORO\\CSHARP\\SLN_FACTURE2018\\DATABASE\\FACTURE.MDF;integrated security=True;connect timeout=30;";
optionsBuilder
.UseLazyLoadingProxies()
.UseSqlServer(myConnectionString);
et commenter le reste
https://docs.microsoft.com/en-us/ef/core/querying/related-data/lazy
Aucun commentaire:
Enregistrer un commentaire