public static IAppBuilder UseElmoViewer(this IAppBuilder app, ElmoViewerOptions options) { if (!app.Properties.ContainsKey(ElmoConstants.ErrorLogPropertyKey) || !(app.Properties[ElmoConstants.ErrorLogPropertyKey] is IErrorLog)) throw new InvalidOperationException("Can't use the Elmo Viewer without registering an Error Log first."); if (options.Path == null || !options.Path.HasValue) throw new InvalidOperationException("Can't use the Elmo Viewer without a root path."); return app.MapWhen(context => context.Request.Path.StartsWithSegments(options.Path), builder => Configuration(builder, options)); }
private static void Configuration(IAppBuilder appBuilder, ElmoViewerOptions options) { var errorLog = (IErrorLog) appBuilder.Properties[ElmoConstants.ErrorLogPropertyKey]; appBuilder.Use<RemoteAccessErrorMiddleware>(options); appBuilder.Use<ErrorJsonMiddleware>(options, errorLog); appBuilder.Use<ErrorRssMiddleware>(options, errorLog); appBuilder.Use<ErrorDigestRssMiddleware>(options, errorLog); appBuilder.Use<ErrorLogDownloadMiddleware>(options, errorLog); appBuilder.Use<ErrorLogCssMiddleware>(options); appBuilder.Use<ErrorDetailViewMiddleware>(options, errorLog); appBuilder.Use<ErrorLogViewMiddleware>(options, errorLog); appBuilder.Use<NotFoundErrorMiddleware>(); }
private static void Configuration(IAppBuilder appBuilder, ElmoViewerOptions options) { var errorLog = (IErrorLog)appBuilder.Properties[ElmoConstants.ErrorLogPropertyKey]; appBuilder.Use <RemoteAccessErrorMiddleware>(options); appBuilder.Use <ErrorJsonMiddleware>(options, errorLog); appBuilder.Use <ErrorRssMiddleware>(options, errorLog); appBuilder.Use <ErrorDigestRssMiddleware>(options, errorLog); appBuilder.Use <ErrorLogDownloadMiddleware>(options, errorLog); appBuilder.Use <ErrorLogCssMiddleware>(options); appBuilder.Use <ErrorDetailViewMiddleware>(options, errorLog); appBuilder.Use <ErrorLogViewMiddleware>(options, errorLog); appBuilder.Use <NotFoundErrorMiddleware>(); }
public static IAppBuilder UseElmoViewer(this IAppBuilder app, ElmoViewerOptions options) { if (!app.Properties.ContainsKey(ElmoConstants.ErrorLogPropertyKey) || !(app.Properties[ElmoConstants.ErrorLogPropertyKey] is IErrorLog)) { throw new InvalidOperationException("Can't use the Elmo Viewer without registering an Error Log first."); } if (options.Path == null || !options.Path.HasValue) { throw new InvalidOperationException("Can't use the Elmo Viewer without a root path."); } return(app.MapWhen(context => context.Request.Path.StartsWithSegments(options.Path), builder => Configuration(builder, options))); }