Skip to content

Commit 82ae7f2

Browse files
committed
modify
1 parent 3fe4e46 commit 82ae7f2

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

src/Senparc.CO2NET.AspNet/Register.cs

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,29 @@
1212
Modification Identifier: Senparc - 20240728
1313
Modification Description: v1.4.0 .NET 6.0 and .NET 8.0 assemblies no longer depend on Microsoft.AspNetCore.Hosting.Abstractions and Microsoft.AspNetCore.Http.Abstractions
1414
15-
----------------------------------------------------------------*/
16-
17-
#if !NET462
18-
using Microsoft.AspNetCore.Builder;
19-
using System;
20-
using System.Collections.Generic;
21-
using System.Text;
22-
using Senparc.CO2NET.Cache;
23-
using Senparc.CO2NET.RegisterServices;
24-
using Microsoft.Extensions.Options;
25-
using Microsoft.Extensions.DependencyInjection;
26-
#endif
27-
28-
namespace Senparc.CO2NET.AspNet
29-
{
15+
----------------------------------------------------------------*/
16+
17+
18+
#if !NET462
19+
using Microsoft.AspNetCore.Builder;
20+
using System;
21+
using System.Collections.Generic;
22+
using System.Text;
23+
using Senparc.CO2NET.Cache;
24+
using Senparc.CO2NET.RegisterServices;
25+
using Microsoft.Extensions.Options;
26+
using Microsoft.Extensions.DependencyInjection;
27+
#endif
28+
29+
namespace Senparc.CO2NET.AspNet
30+
{
3031
/// <summary>
3132
/// Senparc.CO2NET.AspNet Basic Information Registration
3233
/// </summary>
33-
public static class Register
34-
{
35-
#if !NET462
36-
34+
public static class Register
35+
{
36+
#if !NET462
37+
3738
/// <summary>
3839
/// Start Senparc.CO2NET initialization parameter process (ASP.NET Core)
3940
/// </summary>
@@ -46,21 +47,21 @@ public static class Register
4647
/// <para>(LocalContainerCacheStrategy, RedisContainerCacheStrategy, MemcacheContainerCacheStrategy are already automatically registered),</para>
4748
/// <para>If set to null (note: not delegate returns null, but the entire delegate parameter is null), it will automatically use reflection to scan all possible extension cache strategies</para></param>
4849
/// <returns></returns>
49-
public static IRegisterService UseSenparcGlobal(this IApplicationBuilder registerService,
50-
Microsoft.Extensions.Hosting.IHostEnvironment/*IHostingEnvironment*/ env,
51-
SenparcSetting senparcSetting = null,
52-
Action<RegisterService> registerConfigure = null,
53-
bool autoScanExtensionCacheStrategies = false,
54-
Func<IList<IDomainExtensionCacheStrategy>> extensionCacheStrategiesFunc = null)
55-
{
56-
senparcSetting = senparcSetting ?? registerService.ApplicationServices.GetService<IOptions<SenparcSetting>>().Value;
57-
50+
public static IRegisterService UseSenparcGlobal(this IApplicationBuilder registerService,
51+
Microsoft.Extensions.Hosting.IHostEnvironment/*IHostingEnvironment*/ env,
52+
SenparcSetting senparcSetting = null,
53+
Action<RegisterService> registerConfigure = null,
54+
bool autoScanExtensionCacheStrategies = false,
55+
Func<IList<IDomainExtensionCacheStrategy>> extensionCacheStrategiesFunc = null)
56+
{
57+
senparcSetting = senparcSetting ?? registerService.ApplicationServices.GetService<IOptions<SenparcSetting>>().Value;
58+
5859
//Initialize the global RegisterService object and store SenparcSetting information
59-
var register = Senparc.CO2NET.AspNet.RegisterServices.
60-
RegisterService.Start(env, senparcSetting);
61-
62-
return Senparc.CO2NET.Register.UseSenparcGlobal(senparcSetting, registerConfigure, autoScanExtensionCacheStrategies, extensionCacheStrategiesFunc);
63-
}
64-
#endif
65-
}
66-
}
60+
var register = Senparc.CO2NET.AspNet.RegisterServices.
61+
RegisterService.Start(env, senparcSetting);
62+
63+
return Senparc.CO2NET.Register.UseSenparcGlobal(senparcSetting, registerConfigure, autoScanExtensionCacheStrategies, extensionCacheStrategiesFunc);
64+
}
65+
#endif
66+
}
67+
}

0 commit comments

Comments
 (0)