Page 1 of 1

Register a Context with dependency injection container in Blazor Application

Posted: Wed 10 Mar 2021 18:08
by gstenstrom
I have a MS SQL Server database which I have built a LinqConnect Model on top of. I am learning .NET COre and specifically Blazor. I cannot figure out how to register the context with my .NET Core Blazor application in the startup.cs.

The following results in a type conversion error. "There is no implicit reference conversion from MyLinqConnectDBCtx to Microsoft.EntityFrameworkCore.DbContext".

Code: Select all

public void ConfigureServices(IServiceCollection services)
{
     services.AddDbContext<MyLinqConnectDBCtx>(options => options.UseSqlServer(connstring)); 
}
I have looked everywhere and can find no guidance on this at all. It means it's probably something dumb on my part but I got no idea what to try at this point.

Re: Register a Context with dependency injection container in Blazor Application

Posted: Fri 12 Mar 2021 16:28
by Shalex
You should create Devart EF Core Model *.efml (product Entity Developer for Entity Framework) instead of Devart LinqConnect Model *.lqml (product LinqConnect) to follow the tutorials like this one: https://docs.microsoft.com/en-us/aspnet ... etcore-5.0.