// From https://jasperfx.github.io/lamar/documentation/ioc/aspnetcore/ // Take in Lamar's ServiceRegistry instead of IServiceCollection // as your argument, but fear not, it implements IServiceCollection // as well public void ConfigureContainer(ServiceRegistry services) { services.AddEFSecondLevelCache(options => { options.UseMemoryCacheProvider() .CacheAllQueries(CacheExpirationMode.Absolute, TimeSpan.FromMinutes(30)); }); var connectionString = Configuration["ConnectionStrings:ApplicationDbContextConnection"]; if (connectionString.Contains("%CONTENTROOTPATH%")) { connectionString = connectionString.Replace("%CONTENTROOTPATH%", _contentRootPath); } services.AddConfiguredMsSqlDbContext(connectionString); services.AddControllersWithViews(); // Also exposes Lamar specific registrations // and functionality services.Scan(s => { s.TheCallingAssembly(); s.WithDefaultConventions(); }); }