/// <summary> /// Adds the WelcomePageMiddleware to the pipeline with the given options. /// </summary> /// <param name="builder"></param> /// <param name="options"></param> /// <returns></returns> public static IAppBuilder UseWelcomePage(this IAppBuilder builder, WelcomePageOptions options) { if (builder == null) { throw new ArgumentNullException("builder"); } return(builder.Use(typeof(WelcomePageMiddleware), options)); }
public void Configuration(IAppBuilder app) { //app.Use(typeof (MiComponente)); //app.Use(ManageRequest); var options = new WelcomePageOptions() { Path = new PathString("/home") }; app.Use <WelcomePageMiddleware>(options); }
/// <summary> /// Adds the WelcomePageMiddleware to the pipeline with the given options. /// </summary> /// <param name="app"></param> /// <param name="options"></param> /// <returns></returns> public static IApplicationBuilder UseWelcomePage(this IApplicationBuilder app, WelcomePageOptions options) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return(app.UseMiddleware <WelcomePageMiddleware>(Options.Create(options))); }
/// <summary> /// Creates a default web page for new applications. /// </summary> /// <param name="next"></param> /// <param name="options"></param> public WelcomePageMiddleware(RequestDelegate next, IOptions <WelcomePageOptions> options) { if (next == null) { throw new ArgumentNullException(nameof(next)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } _next = next; _options = options.Value; }
/// <summary> /// Adds the WelcomePageMiddleware to the pipeline with the given options. /// </summary> /// <param name="builder"></param> /// <param name="options"></param> /// <returns></returns> public static IApplicationBuilder UseWelcomePage(this IApplicationBuilder builder, WelcomePageOptions options) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } return(builder.Use(next => new WelcomePageMiddleware(next, options).Invoke)); }
/// <summary> /// Adds the WelcomePageMiddleware to the pipeline with the given options. /// </summary> /// <param name="builder"></param> /// <param name="options"></param> /// <returns></returns> public static IApplicationBuilder UseWelcomePage([NotNull] this IApplicationBuilder builder, WelcomePageOptions options) { return(builder.Use(next => new WelcomePageMiddleware(next, options).Invoke)); }