You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature Add Splat Registrations to IViewFor Generator (#289)
* Add Attribute Property
* Add Splat registration support to IViewFor generator
Introduces SplatRegistrationType to IViewFor attributes and source generator, enabling automatic registration of views for view models in Splat's service locator. Updates documentation, tests, and sample usage to demonstrate new registration options and extension method for bulk registration.
* Reduce the use of string builder
* Update IViewForGeneratorTests.FromIViewFor#ReactiveUI.ReactiveUISourceGeneratorsExtensions.g.verified.cs
-`[IViewFor<YourViewModelType>(RegistrationType = SplatRegistrationType.PerRequest)]` with Splat Registration Type for IViewFor registration.
44
+
-`[IViewFor<YourViewModelType>(RegistrationType = SplatRegistrationType.LazySingleton)]` Generic with Splat Registration Type for IViewFor registration.
45
+
-`[IViewFor<YourViewModelType>(RegistrationType = SplatRegistrationType.Constant)]` Generic with Splat Registration Type for IViewFor registration.
-`[BindableDerivedList]` Generates a derived list from a ReadOnlyObservableCollection backing field
44
49
-`[ReactiveCollection]` Generates property changed notifications on add, remove, new actions on a ObservableCollection backing field
45
50
51
+
#### IViewFor Registration generator
52
+
53
+
To register all views for view models registered via the IViewFor Source Generator with a specified `RegistrationType`, call the following method during application startup:
- For ReactiveUI versions **older than V19.5.31**, all `[ReactiveCommand]` options are supported except for async methods with a `CancellationToken`.
48
60
- For **.NET Framework 4.8 and older**, add [Polyfill by Simon Cropp](https://github.com/SimonCropp/Polyfill) or [PolySharp by Sergio Pedri](https://github.com/Sergio0694/PolySharp) to your project and set the `LangVersion` to 12.0 or later in your project file.
@@ -63,11 +75,17 @@ Generates read-only properties backed by an `ObservableAsPropertyHelper` based o
63
75
Generates commands, with options to add attributes or enable `CanExecute` functionality.
64
76
65
77
### `[IViewFor]`
66
-
Links a view to a view model for data binding.
78
+
Links a view to a view model for data binding. Supports generic types and Splat registration.
67
79
68
80
### `[RoutedControlHost]` and `[ViewModelControlHost]`
69
81
Platform-specific attributes for control hosting in WinForms applications.
70
82
83
+
### `[BindableDerivedList]`
84
+
Generates a derived list from a `ReadOnlyObservableCollection` backing field.
85
+
86
+
### `[ReactiveCollection]`
87
+
Generates property changed notifications on add, remove, and new actions on an `ObservableCollection` backing field.
88
+
71
89
## Historical Approach
72
90
73
91
### Read-Write Properties
@@ -525,6 +543,35 @@ The class must inherit from a UI Control from any of the following platforms and
525
543
- Avalonia (Avalonia)
526
544
- Uno (Windows.UI.Xaml).
527
545
546
+
### IViewFor with Splat Registration Type
547
+
548
+
Choose from the following Splat Registration Types:
549
+
-`SplatRegistrationType.PerRequest`
550
+
-`SplatRegistrationType.LazySingleton`
551
+
-`SplatRegistrationType.Constant`
552
+
-`SplatRegistrationType.None` (Default if not specified - no registration is performed)
Copy file name to clipboardExpand all lines: src/ReactiveUI.SourceGenerator.Tests/IVIEWFOR/IViewForGeneratorTests.FromIViewFor#ReactiveUI.SourceGenerators.IViewForAttribute.g.verified.cs
Copy file name to clipboardExpand all lines: src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePartialProperties#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs
Copy file name to clipboardExpand all lines: src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactiveProperiesWithAttributes#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs
Copy file name to clipboardExpand all lines: src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactiveProperties#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs
Copy file name to clipboardExpand all lines: src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesCalledValue#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs
Copy file name to clipboardExpand all lines: src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithAccess#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs
Copy file name to clipboardExpand all lines: src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithAttributesAccessAndInheritance#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs
0 commit comments