Search code examples
c#asp.netaspnetboilerplate

ASP.NET BoilerPlate: How do I inject object of DbContext in application service?


How do I inject object of DbContext in application service?

Need to access it to create clone of a entity record.


Solution

  • You can use IDbContextProvider<TDbContext> _sampleDbContextProvider as constructor injection, using with _sampleDbContextProvider.GetDbContext();