From 26a847d9d6f019f2f7371a533245f266a45a64d3 Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Mon, 10 Jan 2022 12:03:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?doc:=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Services/CacheManager.cs | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/BootstrapBlazor/Services/CacheManager.cs b/src/BootstrapBlazor/Services/CacheManager.cs index 29a864004..fa75fd386 100644 --- a/src/BootstrapBlazor/Services/CacheManager.cs +++ b/src/BootstrapBlazor/Services/CacheManager.cs @@ -58,10 +58,10 @@ internal class CacheManager : ICacheManager public T GetOrCreate(object key, Func factory) => Cache.GetOrCreate(key, entry => { #if DEBUG - entry.SlidingExpiration = TimeSpan.FromSeconds(5); + entry.SlidingExpiration = TimeSpan.FromSeconds(5); #endif - if (key is not string) + if (key is not string) { entry.SetSlidingExpiration(TimeSpan.FromMinutes(5)); } @@ -74,10 +74,10 @@ internal class CacheManager : ICacheManager public Task GetOrCreateAsync(object key, Func> factory) => Cache.GetOrCreateAsync(key, async entry => { #if DEBUG - entry.SlidingExpiration = TimeSpan.FromSeconds(5); + entry.SlidingExpiration = TimeSpan.FromSeconds(5); #endif - if (key is not string) + if (key is not string) { entry.SetSlidingExpiration(TimeSpan.FromMinutes(5)); } @@ -132,8 +132,8 @@ internal class CacheManager : ICacheManager return Instance.GetOrCreate(cacheKey, entry => { var dn = ""; - // search in Localization - var localizer = CreateLocalizerByType(t); + // search in Localization + var localizer = CreateLocalizerByType(t); var stringLocalizer = localizer?[fieldName]; if (stringLocalizer != null && !stringLocalizer.ResourceNotFound) { @@ -145,15 +145,15 @@ internal class CacheManager : ICacheManager dn = field?.GetCustomAttribute(true)?.Name ?? field?.GetCustomAttribute(true)?.Description; - // search in Localization again - if (!string.IsNullOrEmpty(dn)) + // search in Localization again + if (!string.IsNullOrEmpty(dn)) { dn = GetLocalizerValueByKey(dn); } } - // add display name into cache - if (type.Assembly.IsDynamic) + // add display name into cache + if (type.Assembly.IsDynamic) { entry.SetSlidingExpirationForDynamicAssembly(); } @@ -170,8 +170,8 @@ internal class CacheManager : ICacheManager var displayName = Instance.GetOrCreate(cacheKey, entry => { string? dn = null; - // 显示名称为空时通过资源文件查找 FieldName 项 - var localizer = modelType.Assembly.IsDynamic ? null : CreateLocalizerByType(modelType); + // 显示名称为空时通过资源文件查找 FieldName 项 + var localizer = modelType.Assembly.IsDynamic ? null : CreateLocalizerByType(modelType); var stringLocalizer = localizer?[fieldName]; if (stringLocalizer != null && !stringLocalizer.ResourceNotFound) { @@ -236,8 +236,8 @@ internal class CacheManager : ICacheManager return Instance.GetOrCreate(cacheKey, entry => { string? ret = null; - // 通过资源文件查找 FieldName 项 - var localizer = CreateLocalizerByType(modelType); + // 通过资源文件查找 FieldName 项 + var localizer = CreateLocalizerByType(modelType); var stringLocalizer = localizer?[$"{fieldName}.PlaceHolder"]; if (stringLocalizer != null && !stringLocalizer.ResourceNotFound) { @@ -267,8 +267,8 @@ internal class CacheManager : ICacheManager { var props = modelType.GetRuntimeProperties().AsEnumerable(); - // 支持 MetadataType - var metadataType = modelType.GetCustomAttribute(false); + // 支持 MetadataType + var metadataType = modelType.GetCustomAttribute(false); if (metadataType != null) { props = props.Concat(metadataType.MetadataClassType.GetRuntimeProperties()); @@ -459,8 +459,8 @@ public static class ICacheManagerExtensions var cacheKey = $"Localizer-{cultureName}-{assembly.GetName().Name}-{typeName}"; return cache.GetOrCreate(cacheKey, entry => { - // 获得程序集中的资源文件 stream - var sections = option.GetJsonStringConfig(assembly); + // 获得程序集中的资源文件 stream + var sections = option.GetJsonStringConfig(assembly); var v = sections .FirstOrDefault(kv => typeName.Equals(kv.Key, StringComparison.OrdinalIgnoreCase))? .GetChildren() -- Gitee From cea1f8dd0457883a317e2afa8c1f514cb1c33649 Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Mon, 10 Jan 2022 16:25:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E8=BF=90=E8=A1=8C=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Shared/Shared/HomeLayout.razor | 10 ++++++++++ .../wwwroot/css/bootstrap.blazor.bundle.min.css | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Shared/Shared/HomeLayout.razor b/src/BootstrapBlazor.Shared/Shared/HomeLayout.razor index 620b51963..db3b455e1 100644 --- a/src/BootstrapBlazor.Shared/Shared/HomeLayout.razor +++ b/src/BootstrapBlazor.Shared/Shared/HomeLayout.razor @@ -84,6 +84,7 @@