返回提交历史
Modified
AutoConfig.Analyzer.Test/SystemProfile.cs
+1
-1
Modified
XFEExtension.NetCore.AutoConfig.Analyzer/Generator/ProfilePropertyAutoGenerator.cs
+2
-2
Modified
XFEExtension.NetCore.AutoConfig/XFEExtension.NetCore.AutoConfig.csproj
+2
-2
XFEstudio/XFEExtension.NetCore.AutoConfig
修复可为空类型的添加问题
32781fb
代码差异
3 个文件
+5
-5
@@ -5,7 +5,7 @@ namespace AutoConfig.Analyzer.Test;
5
5
public partial class SystemProfile : XFEProfile
6
6
{
7
7
[ProfileProperty]
8
private string myText = "";
8
private string? myText = "";
9
9
[ProfileProperty]
10
10
private int myInt = 0;
11
11
@@ -53,8 +53,8 @@ public class ProfilePropertyAutoGenerator : IIncrementalGenerator
53
53
var instancePropertyName = $"Instance{propertyName}";
54
54
var getMethodName = $"Get{propertyName}Property";
55
55
var setMethodName = $"Set{propertyName}Property";
56
initializerBlockStatements.Add(SyntaxFactory.ParseStatement($"this.PropertyInfoDictionary.Add(nameof({propertyName}), typeof({propertyType}));"));
57
initializerBlockStatements.Add(SyntaxFactory.ParseStatement($"this.PropertySetFuncDictionary.Add(nameof({propertyName}), (value) => this.{fieldName} = ({propertyType})value);"));
56
initializerBlockStatements.Add(SyntaxFactory.ParseStatement($"this.PropertyInfoDictionary.Add(nameof({propertyName}), typeof({propertyType.ToString().Replace("?", string.Empty).Replace(" ", string.Empty)}));"));
57
initializerBlockStatements.Add(SyntaxFactory.ParseStatement($"this.PropertySetFuncDictionary.Add(nameof({propertyName}), (value) => this.{fieldName} = ({propertyType.ToString().Replace("?", string.Empty).Replace(" ", string.Empty)})value);"));
58
58
initializerBlockStatements.Add(SyntaxFactory.ParseStatement($"this.PropertyGetFuncDictionary.Add(nameof({propertyName}), () => this.{fieldName});"));
59
59
GetProfilePropertyAttributeList(fieldDeclarationSyntax).ForEach(attribute =>
60
60
{
@@ -17,7 +17,7 @@
17
17
<PackageTags>XFE;config;profile;auto</PackageTags>
18
18
<PackageReleaseNotes>## 调整
19
19
20
修复符号转义问题
20
修复可为空类型的添加问题
21
21
22
22
## 新增
23
23
@@ -27,7 +27,7 @@
27
27
28
28
无</PackageReleaseNotes>
29
29
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
30
<Version>2.0.3</Version>
30
<Version>2.0.4</Version>
31
31
<GenerateDocumentationFile>True</GenerateDocumentationFile>
32
32
</PropertyGroup>
33
33