Do not add the configuration for CacheTagHelperOptions to the container multiple times

This commit is contained in:
Javier Calvarro Nelson 2017-07-10 19:10:04 -07:00
parent 0c07e1e725
commit c43da19ff1
2 changed files with 1 additions and 4 deletions

View File

@ -12,6 +12,6 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
/// The maximum total size in bytes that will be cached by the <see cref="CacheTagHelper"/>
/// at any given time.
/// </summary>
public long SizeLimit { get; set; }
public long SizeLimit { get; set; } = 100 * 1024 * 1024; // 100MB
}
}

View File

@ -14,8 +14,6 @@ namespace Microsoft.Extensions.DependencyInjection
/// </summary>
public static class TagHelperServicesExtensions
{
private const int DefaultCacheMaximumSizeInBytes = 100 * 1024 * 1024; // 100MB
/// <summary>
/// Adds MVC cache tag helper services to the application.
/// </summary>
@ -35,7 +33,6 @@ namespace Microsoft.Extensions.DependencyInjection
// Required default services for cache tag helpers
builder.Services.AddDistributedMemoryCache();
builder.Services.TryAddSingleton<CacheTagHelperMemoryCacheFactory>();
builder.AddCacheTagHelperLimits(options => options.SizeLimit = DefaultCacheMaximumSizeInBytes);
return builder;
}