diff --git a/zero/ApplicationBuilderExtensions.cs b/zero/ApplicationBuilderExtensions.cs index 29056ed9..0a4e5b1d 100644 --- a/zero/ApplicationBuilderExtensions.cs +++ b/zero/ApplicationBuilderExtensions.cs @@ -7,6 +7,7 @@ public static class ApplicationBuilderExtensions public static IApplicationBuilder UseZero(this IApplicationBuilder app) { app.UseMiddleware(); + app.UseOutputCache(); ZeroBuilder.Modules.Configure(app, null, app.ApplicationServices); return app; } diff --git a/zero/Configuration/ZeroOptions.cs b/zero/Configuration/ZeroOptions.cs index d469e274..fcd2028c 100644 --- a/zero/Configuration/ZeroOptions.cs +++ b/zero/Configuration/ZeroOptions.cs @@ -12,6 +12,9 @@ public class ZeroOptions : IZeroOptions /// public string Language { get; set; } = "en_US"; + /// + public string AppName { get; set; } + /// public TimeSpan TokenExpiration { get; set; } @@ -51,6 +54,11 @@ public interface IZeroOptions /// public string Language { get; set; } + /// + /// Name of the app (used in logging and otehr areas) + /// + public string AppName { get; set; } + /// /// Expiration of a generated change token for an entity /// diff --git a/zero/Metadata/MetadataService.cs b/zero/Metadata/MetadataService.cs index 51eef65b..3b207194 100644 --- a/zero/Metadata/MetadataService.cs +++ b/zero/Metadata/MetadataService.cs @@ -28,8 +28,7 @@ public class MetadataService : IMetadataService Image = options.Image, Author = options.Author, PageName = pageName, - AppVersion = Assembly.GetEntryAssembly().GetCustomAttribute().InformationalVersion - }; + AppVersion = Assembly.GetEntryAssembly()!.GetCustomAttribute()?.InformationalVersion.Split('+').FirstOrDefault()}; // generate robots bool noIndex = options.NoIndex ?? false; diff --git a/zero/ZeroBuilder.cs b/zero/ZeroBuilder.cs index 4ff8173c..4c251191 100644 --- a/zero/ZeroBuilder.cs +++ b/zero/ZeroBuilder.cs @@ -1,5 +1,6 @@ using FluentValidation; using Microsoft.AspNetCore.Antiforgery; +using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -36,13 +37,18 @@ public class ZeroBuilder _startupOptions.AssemblyDiscoveryRules.Add(new ZeroAssemblyDiscoveryRule()); setupAction?.Invoke(_startupOptions); + //string appName = configuration.GetValue("Zero:AppName").Or("zero-app"); + //services.AddDataProtection();.PersistKeysToRegistry() + services.AddControllers(); + services.AddOutputCache(); Mvc = services.AddRazorPages(); Mvc.AddDataAnnotationsLocalization(); services.Configure(opts => opts.Cookie.Name = "zero.antiforgery"); + // adds and discovers additional and built-in assemblies new AssemblyDiscovery(Mvc).Execute(_startupOptions.AssemblyDiscoveryRules); diff --git a/zero/zero.csproj b/zero/zero.csproj index 9d8b49dd..2f9e77cd 100644 --- a/zero/zero.csproj +++ b/zero/zero.csproj @@ -14,9 +14,9 @@ - + - + \ No newline at end of file