How can I use generator in a viewmodel that modifies a model class ? #116
rgranatagreisch
started this conversation in
General
Replies: 1 comment 2 replies
-
@rgranatagreisch I'm transferring this to the .NET Community Toolkit where we can better answer questions related to the MVVM Toolkit. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello !
I am just starting an internship, and I have been tasked with building a .NET 5 - WPF application. We have decided that it should use the MVVM pattern, and one of the programmers advised me to have a look at "Source Generators". It does, indeed, looks very promising !
As I was planning to use the MVVM toolkit in my app anyway, I decided to try out the generator. But I am facing some issues, the first one being the hard-to-find documentation on the subject. I do understand it is a relatively new project, and I guess this issue will be gone as the project evolves.
My second problem is, thus, linked to the first one. I have always made my viewmodels as "model wrappers", meaning that I always have a private field that is an instance of the model, and then my public properties are used to set / get the model fields. This allows me to keep my model "easily savable" and my viewmodel "easily displayable". But I have no idea how to make such a thing with Source Generation. Is it possible ? Is it even considered a good practice ?
Any help would be greatly appreciated !
Thanks !
Beta Was this translation helpful? Give feedback.
All reactions