Esempio n. 1
0
 private static void AddCulture(DiagnosticPageOptions options, Dictionary <string, object> result)
 {
     if (!options.DiagnosticPageConfig.ShowCulture)
     {
         return;
     }
     result["Culture"] = new { CultureInfo.CurrentCulture, CultureInfo.CurrentUICulture };
 }
Esempio n. 2
0
 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 });
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 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();
 }
Esempio n. 5
0
 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
     });
 }
Esempio n. 6
0
 public static IApplicationBuilder UseDiagnosticPage(
     this IApplicationBuilder app,
     DiagnosticPageOptions options,
     params (string key, object value)[] extra)