File tree 2 files changed +14
-2
lines changed
ReactiveUI.SourceGenerators.Execute
ReactiveUI.SourceGenerators.Roslyn/Reactive 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,15 @@ public TestViewModel()
238
238
[ Reactive ]
239
239
public partial string ? PartialPropertyTest { get ; set ; }
240
240
241
+ /// <summary>
242
+ /// Gets or sets the partial property test.
243
+ /// </summary>
244
+ /// <value>
245
+ /// The partial property test.
246
+ /// </value>
247
+ [ Reactive ( UseRequired = true ) ]
248
+ public required partial string ? PartialRequiredPropertyTest { get ; set ; }
249
+
241
250
/// <summary>
242
251
/// Gets the internal test property. Should not prompt to replace with INPC Reactive Property.
243
252
/// </summary>
Original file line number Diff line number Diff line change @@ -72,7 +72,10 @@ public sealed partial class ReactiveGenerator
72
72
token . ThrowIfCancellationRequested ( ) ;
73
73
74
74
var inheritance = propertySymbol . IsVirtual ? " virtual" : propertySymbol . IsOverride ? " override" : string . Empty ;
75
- var useRequired = string . Empty ;
75
+
76
+ attributeData . TryGetNamedArgument ( "UseRequired" , out bool useRequiredArgument ) ;
77
+ var useRequired = useRequiredArgument ? "required " : string . Empty ;
78
+
76
79
var typeNameWithNullabilityAnnotations = propertySymbol . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ;
77
80
var fieldName = propertySymbol . GetGeneratedFieldName ( ) ;
78
81
var propertyName = propertySymbol . Name ;
@@ -326,7 +329,7 @@ private static string GetPropertySyntax(PropertyInfo propertyInfo)
326
329
{{ fieldSyntax }}
327
330
/// <inheritdoc cref="{{ fieldName }} "/>
328
331
{{ propertyAttributes }}
329
- {{ propertyInfo . TargetInfo . TargetVisibility }} {{ propertyInfo . Inheritance }} {{ partialModifier }} {{ propertyInfo . UseRequired }} {{ propertyInfo . TypeNameWithNullabilityAnnotations }} {{ propertyInfo . PropertyName }}
332
+ {{ propertyInfo . TargetInfo . TargetVisibility }} {{ propertyInfo . Inheritance }} {{ propertyInfo . UseRequired }} {{ partialModifier }} {{ propertyInfo . TypeNameWithNullabilityAnnotations }} {{ propertyInfo . PropertyName }}
330
333
{
331
334
get => {{ propertyInfo . FieldName }} ;
332
335
[global::System.Diagnostics.CodeAnalysis.MemberNotNull("{{ fieldName }} ")]
You can’t perform that action at this time.
0 commit comments