Umbraco AddUmbracoDbContext works in controller but context is null when injected into service class
Hi
I'm building a Umbraco 13 solution which where Umbraco will be the backend and have a REACT frontend.
We are migrating a existing web-app so I have hooked up that database with EF Core and so far so good.
builder.Services.AddUmbracoDbContext<dbContext>(
My rough architecure is that I will have a lot of WEB API controllers that in turn will use service-classes that I will hook up with DI for simple reuse between in the different services or other BE use.
So the EF DB I have got connected with using the AddUmbracoDbContext to the WebbApp builder services and using that context in the controllers work just fine.
But when I inject the dbContext in my service it's null but working perfectly fine in the api-controller.
So if someone could give me some pointers to what I need to do in order to get my EF dbContext to work with DI in my services I would be very grateful!
Umbraco AddUmbracoDbContext works in controller but context is null when injected into service class
Hi
I'm building a Umbraco 13 solution which where Umbraco will be the backend and have a REACT frontend.
We are migrating a existing web-app so I have hooked up that database with EF Core and so far so good.
My rough architecure is that I will have a lot of WEB API controllers that in turn will use service-classes that I will hook up with DI for simple reuse between in the different services or other BE use.
So the EF DB I have got connected with using the AddUmbracoDbContext to the WebbApp builder services and using that context in the controllers work just fine.
But when I inject the dbContext in my service it's null but working perfectly fine in the api-controller.
So if someone could give me some pointers to what I need to do in order to get my EF dbContext to work with DI in my services I would be very grateful!
is working on a reply...