add output cache
This commit is contained in:
@@ -7,6 +7,7 @@ public static class ApplicationBuilderExtensions
|
||||
public static IApplicationBuilder UseZero(this IApplicationBuilder app)
|
||||
{
|
||||
app.UseMiddleware<ZeroContextMiddleware>();
|
||||
app.UseOutputCache();
|
||||
ZeroBuilder.Modules.Configure(app, null, app.ApplicationServices);
|
||||
return app;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ public class ZeroOptions : IZeroOptions
|
||||
/// <inheritdoc />
|
||||
public string Language { get; set; } = "en_US";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string AppName { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public TimeSpan TokenExpiration { get; set; }
|
||||
|
||||
@@ -51,6 +54,11 @@ public interface IZeroOptions
|
||||
/// </summary>
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of the app (used in logging and otehr areas)
|
||||
/// </summary>
|
||||
public string AppName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Expiration of a generated change token for an entity
|
||||
/// </summary>
|
||||
|
||||
@@ -28,8 +28,7 @@ public class MetadataService : IMetadataService
|
||||
Image = options.Image,
|
||||
Author = options.Author,
|
||||
PageName = pageName,
|
||||
AppVersion = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion
|
||||
};
|
||||
AppVersion = Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Split('+').FirstOrDefault()};
|
||||
|
||||
// generate robots
|
||||
bool noIndex = options.NoIndex ?? false;
|
||||
|
||||
@@ -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<string>("Zero:AppName").Or("zero-app");
|
||||
//services.AddDataProtection();.PersistKeysToRegistry()
|
||||
|
||||
services.AddControllers();
|
||||
services.AddOutputCache();
|
||||
Mvc = services.AddRazorPages();
|
||||
|
||||
Mvc.AddDataAnnotationsLocalization();
|
||||
|
||||
services.Configure<AntiforgeryOptions>(opts => opts.Cookie.Name = "zero.antiforgery");
|
||||
|
||||
|
||||
// adds and discovers additional and built-in assemblies
|
||||
new AssemblyDiscovery(Mvc).Execute(_startupOptions.AssemblyDiscoveryRules);
|
||||
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="9.0.4" />
|
||||
<PackageReference Include="FluentValidation" Version="11.11.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.3" />
|
||||
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user