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
This documentation covers using ReactiveUI Source Generators to simplify and enhance the use of ReactiveUI objects.
15
4
16
-
Versions older than V19.5.31 to this:
17
-
-[ReactiveCommand] all options supported except Cancellation Token asnyc methods.
5
+
-**Minimum Requirements**:
6
+
-**C# Version**: 12.0
7
+
-**Visual Studio Version**: 17.8.0
8
+
-**ReactiveUI Version**: 19.5.31+
18
9
19
-
For dot net framework 4.8 and older versions please add Polyfill or PolySharp package to your project to gain the IsExternalInit class and set the LangVersion to 12.0 or latest in your project file.
ReactiveUI Source Generators automatically generate ReactiveUI objects to streamline your code. These Source Generators are designed to work with ReactiveUI V19.5.31+ and support the following features:
- For ReactiveUI versions **older than V19.5.31**, all `[ReactiveCommand]` options are supported except for async methods with a `CancellationToken`.
26
+
- For **.NET Framework 4.8 and older**, add [Polyfill by Simon Cropp](https://github.com/Fody/Polyfill) or [PolySharp by Manuel Römer](https://github.com/manuelroemer/PolySharp) to your project and set the `LangVersion` to 12.0 or later in your project file.
27
+
28
+
For more information on analyzer codes, see the [analyzer codes documentation](https://github.com/reactiveui/ReactiveUI.SourceGenerators/blob/main/src/ReactiveUI.SourceGenerators/AnalyzerReleases.Shipped.md).
29
+
30
+
---
31
+
32
+
## Supported Attributes
33
+
34
+
### `[Reactive]`
35
+
Marks properties as reactive, generating getter and setter code.
36
+
37
+
### `[ObservableAsProperty]`
38
+
Generates read-only properties backed by an `ObservableAsPropertyHelper` based on an `IObservable`.
39
+
40
+
### `[ReactiveCommand]`
41
+
Generates commands, with options to add attributes or enable `CanExecute` functionality.
42
+
43
+
### `[IViewFor]`
44
+
Links a view to a view model for data binding.
45
+
46
+
### `[RoutedControlHost]` and `[ViewModelControlHost]`
47
+
Platform-specific attributes for control hosting in WinForms applications.
48
+
49
+
## Historical Approach
50
+
51
+
### Read-Write Properties
52
+
Previously, properties were declared like this:
26
53
27
54
```csharp
28
55
privatestring_name;
@@ -35,6 +62,7 @@ public string Name
35
62
36
63
Before these Source Generators were avaliable we used ReactiveUI.Fody.
37
64
With ReactiveUI.Fody the `[Reactive]` Attribute was placed on a Public Property with Auto get / set properties, the generated code from the Source Generator and the Injected code using Fody are very similar with the exception of the Attributes.
0 commit comments