ReactiveUI icon indicating copy to clipboard operation
ReactiveUI copied to clipboard

[Feature] Roslyn Source Generators

Open adamradocz opened this issue 3 years ago • 1 comments

I'm thinking about creating a source generator for the ReactiveUI project, similar to the CommunityToolkit.Mvvm.SourceGenerators.

My ideas are the following:

ReactiveUI Property Source Generator

[ReactiveProperty]
private DateTime _time;

Generates:

public DateTime Time
{
    get => _time;
    private set => this.RaiseAndSetIfChanged(ref _time, value);
}

Observable As Property Helper Source Generator

[OaphProperty]
private readonly ObservableAsPropertyHelper<string> _text;

Generates:

public string Text => _text.Value;

I'm also considering that only the [ReactiveProperty] should be used and generate the appropriate property based on the type.

DinamicData Property Source Generator

[BindingProperty]
private readonly ReadOnlyObservableCollection<TrackViewModel> _tracks;

Generates:

public ReadOnlyObservableCollection<TrackViewModel> InboundTracks => _tracks; 

Any idea?

adamradocz avatar Jul 12 '22 19:07 adamradocz