File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
ReactiveUI.SourceGenerators.Execute
ReactiveUI.SourceGenerators.Roslyn/Reactive Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,15 @@ public TestViewModel()
227227 [ Reactive ]
228228 public partial string ? PartialPropertyTest { get ; set ; }
229229
230+ /// <summary>
231+ /// Gets or sets the partial property test.
232+ /// </summary>
233+ /// <value>
234+ /// The partial property test.
235+ /// </value>
236+ [ Reactive ( UseRequired = true ) ]
237+ public required partial string ? PartialRequiredPropertyTest { get ; set ; }
238+
230239 /// <summary>
231240 /// Gets the internal test property. Should not prompt to replace with INPC Reactive Property.
232241 /// </summary>
Original file line number Diff line number Diff line change @@ -72,7 +72,10 @@ public sealed partial class ReactiveGenerator
7272 token . ThrowIfCancellationRequested ( ) ;
7373
7474 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+
7679 var typeNameWithNullabilityAnnotations = propertySymbol . Type . GetFullyQualifiedNameWithNullabilityAnnotations ( ) ;
7780 var fieldName = propertySymbol . GetGeneratedFieldName ( ) ;
7881 var propertyName = propertySymbol . Name ;
@@ -326,7 +329,7 @@ private static string GetPropertySyntax(PropertyInfo propertyInfo)
326329 {{ fieldSyntax }}
327330 /// <inheritdoc cref="{{ fieldName }} "/>
328331 {{ 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 }}
330333 {
331334 get => {{ propertyInfo . FieldName }} ;
332335 [global::System.Diagnostics.CodeAnalysis.MemberNotNull("{{ fieldName }} ")]
You can’t perform that action at this time.
0 commit comments