-
Notifications
You must be signed in to change notification settings - Fork 46
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
[MVUX] Creating a State<XXXModel>
break code gen if XXXModel
is a record
#2310
Comments
The most appropriate solution would be to generate types for the "second generation kind" (cf. #2307 (reply in thread)) into a different namespace (and into another file name). Note: Currently even if we add the |
For reference, this is what we're thinking in terms of updating naming conventions: Given: record Person; For each model XYZModel, instead of generating BindableXYZModel, we would generate XYZViewModel. For each unique IState, instead of generating BindableEntity, we would generate EntityState. So you would end up here with 3 classes generated: |
Conventions are great... Custom Conventions are better and Configurability should always be possible. [MvuxSkip]
public record MyModel { }
[MvuxModel]
public record MyRecord { }
[assembly: MvuxConvention(Suffix = "Modelo")] What we see in the above example is something where we can:
|
Sure, we could eventually add some configurability like for new Suffixes. I'd be curious to see a case where you want to skip a class suffixed Model containing IFeed/IState public properties. |
I could be mistaken... but I thought the whole point is that we have a convention for the Generation on Type name rather than looking for Records that have IFeed/IState. With any such convention then we're already ignoring types that may have IFeed/IState. |
@dansiegel You can use the The issue is that there is still a bug in the handling of those attributes (even if we disable the generation for a model, we are generating the sub-bindable that would have been used by that model) + naming clash of generated types. |
I agree with @dansiegel , by default my models are basicaly a bunch of properties with no other functionality, maybe some calculated values. Even if you don't generate the Bindable (Reactive) part, I still need to notify property changes. Besides: [MvuxSkip]
[MvuxModel]
public record MyModel { } you could add: [MvuxObservable]
public record MyRecord{ } |
In MVUX, a Model is the record containing State. If you need INPC, that's because values can change, either when they're being loaded (thats what IFeed does) or because user made an action (that's what IState does). So the convention is that your model is suffixed by Model and contains either IFeed and/or IState. There's nothing less or more to it. |
Discussed in #2307
Result of investigation (with more details) can be found here : #2307 (reply in thread)
Originally posted by mcNets May 25, 2024
Testing C# Markup + MVUX, while trying to reproduce the Counter example, I encountered an error when adding the second partial record, the BindableViewModel is not accessible anymore. I tried this in two different projects.
MainPage
MainModel
MachineModel
UnoMvux1.zip
The text was updated successfully, but these errors were encountered: