How to call a Repository on application startup using DI while creating HttpContext
问题 I need to make a database call when the application starts up to set up some cache. I have custom DbContext class which has a HttpContext within to hold the current sql connection as follows: public sealed class DataContext : IDataContext { IDbConnection connection = null; IDbTransaction transaction = null; Guid id = Guid.Empty; List<String> ConnectionList; public DataContext(string Con = RuntimeDTO.DEFAULTDB) { HttpContext context = AppHttpContext.Current; if (context.Items[Con] == null) {