private static void AddCulture(DiagnosticPageOptions options, Dictionary <string, object> result) { if (!options.DiagnosticPageConfig.ShowCulture) { return; } result["Culture"] = new { CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture }; }
private static void AddActions(DiagnosticPageOptions options, IApplicationBuilder app, Dictionary <string, object> result) { if (!options.DiagnosticPageConfig.ShowActions) { return; } result["Actions"] = app.ApplicationServices .GetRequiredService <IActionDescriptorCollectionProvider>() .ActionDescriptors .Items .Select(item => new { name = item.DisplayName, item.AttributeRouteInfo.Template }); }
private static void AddHostingEnvironment(DiagnosticPageOptions options, Dictionary <string, object> result) { if (!options.DiagnosticPageConfig.ShowHostingEnvironment) { return; } if (options.Environment == null) { throw new ArgumentException("Environment value is not supplied."); } result["HostingEnvironment"] = options.Environment; }
private static void AddConfiguration(DiagnosticPageOptions options, Dictionary <string, object> result) { if (!options.DiagnosticPageConfig.ShowConfiguration) { return; } if (options.Configuration == null) { throw new ArgumentException("Services value is not supplied."); } result["Configuration"] = options.Configuration.AsEnumerable(); }
private static void AddServices(DiagnosticPageOptions options, Dictionary <string, object> result) { if (!options.DiagnosticPageConfig.ShowServices) { return; } if (options.Services == null) { throw new ArgumentException("Services value is not supplied."); } result["Services"] = options.Services.Select(item => new { lifetime = item.Lifetime.ToString(), type = item.ServiceType.FullName, implementation = item.ImplementationType?.FullName }); }
public static IApplicationBuilder UseDiagnosticPage( this IApplicationBuilder app, DiagnosticPageOptions options, params (string key, object value)[] extra)