You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a Blazor Server Side project it is suggested to not use DbContext like in asp.net core (neither of the three AddSingleton/Scoped/Transient are ok) but instead use it with a Factory
Doing so, the DbContext cannot have multiple constructor like the one auto-generated. Commenting the first ctor without parameters resolves the issue, but you have to do every time you redo the reverse engineering
Steps to reproduce
Create Blazor server side solution adding the dbcontext in startup.cs with
services.AddDbContextFactory(options => options.UseSqlServer(cs));
Use it in a razor component with
[Inject] public IDbContextFactory ContextFactory { get; set; }
var MyRepoService = new MyRepoService (ContextFactory.CreateDbContext());
Further technical details
EF Core Power Tools version: 2.5.665
Database engine: SQL Server
In a Blazor Server Side project it is suggested to not use DbContext like in asp.net core (neither of the three AddSingleton/Scoped/Transient are ok) but instead use it with a Factory
Doing so, the DbContext cannot have multiple constructor like the one auto-generated. Commenting the first ctor without parameters resolves the issue, but you have to do every time you redo the reverse engineering
Steps to reproduce
Create Blazor server side solution adding the dbcontext in startup.cs with
services.AddDbContextFactory(options => options.UseSqlServer(cs));
Use it in a razor component with
[Inject] public IDbContextFactory ContextFactory { get; set; }
var MyRepoService = new MyRepoService (ContextFactory.CreateDbContext());
Further technical details
EF Core Power Tools version: 2.5.665
Database engine: SQL Server
Visual Studio version: 2019 16.10
See error
localhost-1623047631465.log
The text was updated successfully, but these errors were encountered: