コード例 #1
0
 public HangfireDashboardCustomOptionsMiddleware(RequestDelegate next, HangfireDashboardCustomOptions options)
 {
     _next    = next;
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
        /// <summary>
        /// Configure custom options for the Hangfire Dashboard
        /// </summary>
        /// <param name="app">The application builder instance</param>
        /// <param name="options">The custom configuration options for the Hangfire Dashboard</param>
        /// <returns></returns>
        public static IApplicationBuilder UseHangfireDashboardCustomOptions(this IApplicationBuilder app, HangfireDashboardCustomOptions options)
        {
            if (app is null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options is null)
            {
                throw new ArgumentNullException(nameof(options));
            }

#if ASPNETCORE
            return(app.UseMiddleware <HangfireDashboardCustomOptionsMiddleware>(options));
#elif OWIN
            return(app.Use <HangfireDashboardCustomOptionsMiddleware>(options));
#endif
        }