44namespace WebApiClientCore . Analyzers . SourceGenerator
55{
66 /// <summary>
7- /// HttpApiProxyClass初始化器
7+ /// HttpApiProxyClass的静态类初始器
88 /// </summary>
99 static class HttpApiProxyClassInitializer
1010 {
1111 /// <summary>
1212 /// 文件名
1313 /// </summary>
14- public static string FileName => $ "{ nameof ( HttpApiProxyClassInitializer ) } .g.cs";
14+ public static string FileName => $ "{ nameof ( HttpApiProxyClass ) } .g.cs";
1515
1616 /// <summary>
1717 /// 转换为SourceText
@@ -20,26 +20,27 @@ static class HttpApiProxyClassInitializer
2020 public static SourceText ToSourceText ( )
2121 {
2222 var code = $$ """
23- #if NET5_0_OR_GREATER
2423 #pragma warning disable
24+ using System;
2525 namespace WebApiClientCore
2626 {
27- /// <summary>动态依赖初始化器 </summary>
28- [global::System.Reflection.Obfuscation(Exclude = true)]
27+ /// <summary>HttpApi代理类 </summary>
28+ [global::System.Reflection.Obfuscation(Exclude = true)]
2929 [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
3030 [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
31- static partial class HttpApiProxyClassInitializer
32- {
33- /// <summary>初始化本程序集的动态依赖</summary>
31+ static partial class {{ nameof ( HttpApiProxyClass ) }}
32+ {
33+ #if NET5_0_OR_GREATER
34+ /// <summary>初始化代理类</summary>
3435 [global::System.Runtime.CompilerServices.ModuleInitializer]
3536 [global::System.Diagnostics.CodeAnalysis.DynamicDependency(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All, typeof(global::WebApiClientCore.{{ nameof ( HttpApiProxyClass ) }} ))]
3637 public static void Initialize()
3738 {
3839 }
39- }
40+ #endif
41+ }
4042 }
4143 #pragma warning restore
42- #endif
4344 """ ;
4445 return SourceText . From ( code , Encoding . UTF8 ) ;
4546 }
0 commit comments