please help me with this:
I have model with property of Enum type. This property is required, but on View initial value must be empty. Will show watermark..
If I understand correct than model will have not nullable property. But viewModel will have nullable. Is this right way?
Looks like in this case:
- need create viewModel
- viewModel and model will have different data sometimes
- viewModel need logic for set and get correct values to/from model or get null in first time and leave as is model
- viewModel need one more validation rule
Other way is:
Model will have nullable property and required validation:
- can bind to model
- model does not "correspond to reality"
- we need always expose data from nullable enum and forgot about null? or handle it (convert to DTO or something like this)
- nullable property is only UI requirement and can be changed in future