Skip to content

Commit 0a67b63

Browse files
authored
Fix: Improve ObservableAsPropertyAttribute with string (#376)
* Improve ObservableAsPropertyAttribute with string Introduces the PLCInstance class to represent a PLC in the application. Updates TestViewModel to include reactive and observable properties for PLC instance, active status, and port, with initial values. Improves ObservableAsPropertyAttribute documentation and initial value handling in source generator. Updates solution file format from .sln to .slnx. * Fix string type check for property initialization Updated the property type check to use EndsWith("##string") and EndsWith("##string?") instead of direct equality. This ensures correct initialization for string properties with type suffixes.
1 parent cf7ea71 commit 0a67b63

File tree

23 files changed

+159
-195
lines changed

23 files changed

+159
-195
lines changed

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromField#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservableMethods#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservableMethodsWithName#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservableProp#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore
52-
#pragma warning restore
51+
#pragma warning restore

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropNestedClasses#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore
52-
#pragma warning restore
51+
#pragma warning restore

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropertiesWithAttribute#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore
52-
#pragma warning restore
51+
#pragma warning restore

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropertiesWithAttributeNullableRef#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore
52-
#pragma warning restore
51+
#pragma warning restore

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropertiesWithAttributeRef#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore
52-
#pragma warning restore
51+
#pragma warning restore

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropertiesWithName#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore
52-
#pragma warning restore
51+
#pragma warning restore

src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromPartialProperty#ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.verified.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ internal sealed class ObservableAsPropertyAttribute : global::System.Attribute
4141
public bool UseProtected { get; init; } = false;
4242

4343
/// <summary>
44-
/// Gets the Initial value of the OAPH property.
44+
/// Gets the Initial Value of the OAPH property.
45+
/// This should be a string representation of the value. i.e. "42" or "DateTime.Now" or "new List&lt;string&gt;()".
46+
/// String values are automatically quoted.
4547
/// </summary>
46-
/// <value>
47-
/// The initial value of the OAPH property.
48-
/// </value>
4948
public string? InitialValue { get; init; }
5049
}
5150
#nullable restore
52-
#pragma warning restore
51+
#pragma warning restore

0 commit comments

Comments
 (0)