public NlogDashboardContext(HttpContext httpContext, NlogDashboardRoute route, IRazorLightEngine engine, NlogDashboardOptions options) { Route = route ?? throw new ArgumentNullException(nameof(route)); HttpContext = httpContext ?? throw new ArgumentNullException(nameof(httpContext)); Engine = engine ?? throw new ArgumentNullException(nameof(engine)); Options = options; }
public static IServiceCollection AddNlogDashboard(this IServiceCollection services, Action <NlogDashboardOptions> func) { services.AddSingleton <IRazorLightEngine>(new RazorLightEngineBuilder() .UseEmbeddedResourcesProject(typeof(NlogDashboardMiddleware)) .UseMemoryCachingProvider() .Build()); var options = new NlogDashboardOptions(); func(options); services.AddSingleton(options); services.AddTransient(provider => new SqlConnection(options.ConnetionString)); return(services); }