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 @@ -238,6 +238,15 @@ public TestViewModel()
238238 [ Reactive ]
239239 public partial string ? PartialPropertyTest { get ; set ; }
240240
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+
241250 /// <summary>
242251 /// Gets the internal test property. Should not prompt to replace with INPC Reactive Property.
243252 /// </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