Newbie question regarding validation
See original GitHub issueI am a beginner in MVVM and I am not sure which is the best approach:
I have some domain-level models, like User
, Product
, ProductGroup
, etc.
My ViewModels only have one one property which implements INPC, like this:
public ProductGroupViewModel(ProductGroup productGroup) : Screen
{
_productGroup = productGroup;
}
private ProductGroup _productGroup;
public ProductGroup ProductGroup
{
get => _productGroup;
set
{
_productGroup = value;
SetAndNotify(ref _productGroup, value);
}
}
}
In the View, all the binding is done like this, and this works:
Text="{Binding ProductGroup.Name}"
I also use the same View / ViewModel to create a new ProductGroup
and edit an existing one, through the contructor. But in this way, I cannot use Stylet IoC to inject the validator, because my contructing viewmodel does not know how to resolve such a constructor:
public ProductGroupViewModel(ProductGroup productGroup, IModelValidator<ProductGroupViewModel> validator) : base(validator)
{ ... }
What would be the recommended way to solve this issue? Thanks in advance.
Issue Analytics
- State:
- Created 6 years ago
- Comments:28 (14 by maintainers)
Top Results From Across the Web
404 questions with answers in VALIDATION | Science topic
Review and cite VALIDATION protocol, troubleshooting and other methodology information | Contact experts in VALIDATION to get answers.
Read more >Top 10 validation interview questions with answers
What experience do you have in this validation field ? Hopefully if you're applying for this position you have bags of related experience,...
Read more >Newest 'validation' Questions
I've been working on a simple form validation code in JavaScript coupled with an HTML form. The form asks for user's basic information,...
Read more >Newbie Question: Validating Input on Class Attributes
So, I created a class called "ZVEHICLE" and create an attribute called "TRANSMISSION" of type "ZTRANSMISSION_TYPE" (my Data Element) thinking ...
Read more >Beginner's Guide to Design Verification & ...
Learn exactly what Design Verification and Design Validation are, ... Design validation, on the other hand, examines your user needs.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks alot! You have been a great help!
Thanks for your support!