public MigrationsEndPointMiddleware([NotNull] RequestDelegate next, [NotNull] MigrationsEndPointOptions options, bool isDevMode) { Check.NotNull(next, "next"); Check.NotNull(options, "options"); _next = next; _options = options; _isDevMode = isDevMode; }
/// <summary> /// Processes requests to execute migrations operations. The middleware will listen for requests to the path configured in <paramref name="optionsAction"/>. /// </summary> /// <param name="app">The <see cref="IApplicationBuilder"/> to register the middleware with.</param> /// <param name="optionsAction">An action to set the options for the middleware.</param> /// <returns>The same <see cref="IApplicationBuilder"/> instance so that multiple calls can be chained.</returns> public static IApplicationBuilder UseMigrationsEndPoint([NotNull] this IApplicationBuilder app, [NotNull] Action<MigrationsEndPointOptions> optionsAction) { Check.NotNull(app, "builder"); Check.NotNull(optionsAction, "optionsAction"); var options = new MigrationsEndPointOptions(); optionsAction(options); return app.UseMiddleware<MigrationsEndPointMiddleware>(options); }
public MigrationsEndPointMiddleware([NotNull] RequestDelegate next, [NotNull] IServiceProvider serviceProvider, [NotNull] ILoggerFactory loggerFactory, [NotNull] MigrationsEndPointOptions options) { Check.NotNull(next, "next"); Check.NotNull(serviceProvider, "serviceProvider"); Check.NotNull(loggerFactory, "loggerFactory"); Check.NotNull(options, "options"); _next = next; _serviceProvider = serviceProvider; _logger = loggerFactory.Create <MigrationsEndPointMiddleware>(); _options = options; }
/// <summary> /// Initializes a new instance of the <see cref="MigrationsEndPointMiddleware"/> class /// </summary> /// <param name="next">Delegate to execute the next piece of middleware in the request pipeline.</param> /// <param name="serviceProvider">The <see cref="IServiceProvider"/> to resolve services from.</param> /// <param name="logger">The <see cref="Logger{T}"/> to write messages to.</param> /// <param name="options">The options to control the behavior of the middleware.</param> public MigrationsEndPointMiddleware( [NotNull] RequestDelegate next, [NotNull] IServiceProvider serviceProvider, [NotNull] ILogger<MigrationsEndPointMiddleware> logger, [NotNull] MigrationsEndPointOptions options) { Check.NotNull(next, "next"); Check.NotNull(serviceProvider, "serviceProvider"); Check.NotNull(logger, "logger"); Check.NotNull(options, "options"); _next = next; _serviceProvider = serviceProvider; _logger = logger; _options = options; }