Skip to content

Commit 4574c70

Browse files
authored
chore: Update readme/project references (#113)
1 parent 93f0934 commit 4574c70

File tree

11 files changed

+58
-29
lines changed

11 files changed

+58
-29
lines changed

README.md

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,55 @@
1-
# ReactiveUI.SourceGenerators
2-
Use source generators to generate ReactiveUI objects.
3-
The minimum C# version is 12.0 and the minimum Visual Studio version is 17.8.0.
1+
# ReactiveUI Source Generators Documentation
42

5-
These Source Generators were designed to work in full with ReactiveUI V19.5.31 and newer supporting all features, currently:
6-
- [Reactive]
7-
- [ObservableAsProperty]
8-
- [ObservableAsProperty(PropertyName = "ReadOnlyPropertyName")]
9-
- [ReactiveCommand]
10-
- [ReactiveCommand(CanExecute = nameof(IObservableBoolName))] with CanExecute
11-
- [ReactiveCommand][property: AttribueToAddToCommand] with Attribute passthrough
12-
- [IViewFor(nameof(ViewModelName))]
13-
- [RoutedControlHost("YourNameSpace.CustomControl")]
14-
- [ViewModelControlHost("YourNameSpace.CustomControl")]
3+
This documentation covers using ReactiveUI Source Generators to simplify and enhance the use of ReactiveUI objects.
154

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+
189

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.
10+
## Overview
2011

21-
[analyzer codes](https://github.com/reactiveui/ReactiveUI.SourceGenerators/blob/main/src/ReactiveUI.SourceGenerators/AnalyzerReleases.Shipped.md)
12+
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:
2213

23-
# Historical ways
24-
## Read-write properties
25-
Typically properties are declared like this:
14+
- `[Reactive]`
15+
- `[ObservableAsProperty]`
16+
- `[ObservableAsProperty(PropertyName = "ReadOnlyPropertyName")]`
17+
- `[ReactiveCommand]`
18+
- `[ReactiveCommand(CanExecute = nameof(IObservableBoolName))]` with CanExecute
19+
- `[ReactiveCommand][property: AttributeToAddToCommand]` with Attribute passthrough
20+
- `[IViewFor(nameof(ViewModelName))]`
21+
- `[RoutedControlHost("YourNameSpace.CustomControl")]`
22+
- `[ViewModelControlHost("YourNameSpace.CustomControl")]`
23+
24+
### Compatibility Notes
25+
- 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:
2653

2754
```csharp
2855
private string _name;
@@ -35,6 +62,7 @@ public string Name
3562

3663
Before these Source Generators were avaliable we used ReactiveUI.Fody.
3764
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.
65+
3866
```csharp
3967
[Reactive]
4068
public string Name { get; set; }

src/ReactiveUI.SourceGenerators.Execute.Maui/ReactiveUI.SourceGenerators.Execute.Maui.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<ItemGroup>
2727
<ProjectReference Include="..\ReactiveUI.SourceGenerators\ReactiveUI.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
28-
<ProjectReference Include="..\ReactiveUI.SourceGenerators.CodeFixers\ReactiveUI.CodeFixes.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
28+
<ProjectReference Include="..\ReactiveUI.SourceGenerators.Analyzers.CodeFixes\ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
2929
</ItemGroup>
3030

3131
</Project>

src/ReactiveUI.SourceGenerators.Execute/ReactiveUI.SourceGenerators.Execute.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20+
<ProjectReference Include="..\ReactiveUI.SourceGenerators.Analyzers.CodeFixes\ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
2021
<ProjectReference Include="..\ReactiveUI.SourceGenerators\ReactiveUI.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
21-
<ProjectReference Include="..\ReactiveUI.SourceGenerators.CodeFixers\ReactiveUI.CodeFixes.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
2222
</ItemGroup>
2323
</Project>

src/ReactiveUI.SourceGenerators.sln

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# 17
2+
# Visual Studio Version 17
33
VisualStudioVersion = 17.10.35027.167
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionConfig", "SolutionConfig", "{F29AF2F3-DEC8-58BC-043A-1447862C832D}"
@@ -24,7 +24,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.SourceGenerators
2424
EndProject
2525
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestLibs", "TestLibs", "{B86ED9C1-AFFB-4854-AD80-F4B4050CAD0A}"
2626
EndProject
27-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.SourceGenerators.Analyzers.CodeFixes", "ReactiveUI.SourceGenerators.CodeFixers\ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj", "{C89EE66E-E1DC-4A31-9322-20D95CB0D74D}"
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.SourceGenerators.Analyzers.CodeFixes", "ReactiveUI.SourceGenerators.Analyzers.CodeFixes\ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj", "{BD4FADD9-C0E5-46E9-906E-01B04CC856B5}"
2828
EndProject
2929
Global
3030
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -48,10 +48,10 @@ Global
4848
{60C7C031-8765-46D7-8E0D-88CD4949F25B}.Debug|Any CPU.Build.0 = Debug|Any CPU
4949
{60C7C031-8765-46D7-8E0D-88CD4949F25B}.Release|Any CPU.ActiveCfg = Release|Any CPU
5050
{60C7C031-8765-46D7-8E0D-88CD4949F25B}.Release|Any CPU.Build.0 = Release|Any CPU
51-
{C89EE66E-E1DC-4A31-9322-20D95CB0D74D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
52-
{C89EE66E-E1DC-4A31-9322-20D95CB0D74D}.Debug|Any CPU.Build.0 = Debug|Any CPU
53-
{C89EE66E-E1DC-4A31-9322-20D95CB0D74D}.Release|Any CPU.ActiveCfg = Release|Any CPU
54-
{C89EE66E-E1DC-4A31-9322-20D95CB0D74D}.Release|Any CPU.Build.0 = Release|Any CPU
51+
{BD4FADD9-C0E5-46E9-906E-01B04CC856B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
52+
{BD4FADD9-C0E5-46E9-906E-01B04CC856B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
53+
{BD4FADD9-C0E5-46E9-906E-01B04CC856B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
54+
{BD4FADD9-C0E5-46E9-906E-01B04CC856B5}.Release|Any CPU.Build.0 = Release|Any CPU
5555
EndGlobalSection
5656
GlobalSection(SolutionProperties) = preSolution
5757
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)