Skip to main content

All Questions

1 vote
0 answers
1k views

How to you use your DbContext in an IStringLocalizer implementation?

I am building an ASP.NET Core 2 MVC application and want to use database driven localization of resources. I have created a minimal MVC application that illustrates my problem, the source can be found ...
Ben's user avatar
  • 5,675
1 vote
1 answer
1k views

How to get ApplicationDbContext instance in AccountController for ASP .NET Core 2.0 With Individual Authentication?

I'm newbie in ASP .NET Core and need little help. I have created ASP .NET Core 2.0 MVC project with individual authentication. Now I want to access Current ApplicationDbContext in my ...
Zubair Rana's user avatar
  • 2,076
1 vote
1 answer
455 views

How to inject a service into a constructor when creating a new instance of an object?

The Setup: I've registered a configuration service that pulls data from appsettings.json and it works fine. I also have a controller that uses that service to get settings from that file, again this ...
cOborski's user avatar
  • 134
0 votes
1 answer
532 views

How can I inject same class with different Life Cycles on Asp.Net Core DI?

In the past, I used Unity Container to resolve my dependencies with Asp.Net MVC. Now I am planning to use the Asp.Net Core DI instead of Unity that doesn't have at the moment a viable way to integrate ...
Zinov's user avatar
  • 4,090
3 votes
1 answer
2k views

"Cannot find compilation library location for package "enc.dll"" error occur .net core dependency injection

I am building a website using asp.net core mvc, and for the login i added dependency for enc.dll file, which just encrypt/decrypt user information. I made a Seeder class with enc.dll file, which has a ...
ringord's user avatar
  • 928
33 votes
4 answers
83k views

ASP.NET Core 2 Unable to resolve service for type Microsoft EntityFrameworkCore DbContext

When I run my asp.net core 2 projects I get the following error message: InvalidOperationException: Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContext' while attempting to ...
mohammad's user avatar
  • 1,028