-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAPH requires setting _nameHelper #47
Comments
Have you tried included the out parameter like this: this.WhenAnyValue(x => x.SelectedProperty)
.WhereNotNull()
.Select(p => p.Type)
.ToProperty(this, x => x.SearchTermType, out _searchTermTypeHelper); |
Yes, (that is an alternative directly referencing the generated field) which is not what the documentation describes. The documentation shows using it like the ToPropertyEx method used with Fody. Unless there is another extension method provided I dont see how this can work.
Is the documentation wrong?
…________________________________
From: Jeremy Demortier ***@***.***>
Sent: Friday, January 17, 2025 1:36:38 AM
To: wieslawsoltes/ReactiveGenerator ***@***.***>
Cc: stokara ***@***.***>; Author ***@***.***>
Subject: Re: [wieslawsoltes/ReactiveGenerator] OAPH requires setting _nameHelper (Issue #47)
Have you tried included the out parameter like this:
this.WhenAnyValue(x => x.SelectedProperty)
.WhereNotNull()
.Select(p => p.Type)
.ToProperty(this, x => x.SearchTermType, out _searchTermTypeHelper);
—
Reply to this email directly, view it on GitHub<#47 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAIATZSNHGXJYZBFXEYWHKD2LCQHNAVCNFSM6AAAAABVK2WL7OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJXGUZTOMJXGA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
The documentation in the readme and the example in the source (https://github.com/wieslawsoltes/ReactiveGenerator/blob/main/ReactiveGeneratorDemo/ViewModels/OaphViewModel.cs) don't seem to match. |
suggestion: Creating a new extension method SetPropertyEx which would set the generated OAPH is not a bad idea as that is the way the Fody implementation works and would make migrating from Fody easier. e.g.: this.WhenAnyValue(x => x.SelectedProperty) would functionally be: this.WhenAnyValue(x => x.SelectedProperty) |
Here is an example extension method .ToPropertyEx - but it uses reflection so it will impact performance.
|
The extension method I suggested above uses reflection and (at least for me) will often be called in the constructor, so I don't like it. This can be avoided if a "getOaph" method was generated with the generated code, something like this:
where the "fieldName switch" would contain all of the generated oaph variables |
Following the docs I tried:
but when getting to code that references SearchTermType it is null;
however, this code, referencing the generated code backing OAPH field does work:
this is the using the approach I see in ReactiveGeneratorDemo.ViewModels.OaphViewModel
The text was updated successfully, but these errors were encountered: