- consider classic example: Product and Category
- editing Product
- in dropdown Id of Category is selected - Category mapped as object with all fields empty except Id
- when submitting Product edit form - validation gives an error: "Category name is required" (I have Required attribute on Category Name property)
How deal with such errors if I want to use built-in validation (if (!ModelState.IsValid)
)?
Writing custom data binder which would fill all such id-only-objects with values from database comes to mind.
Do you have any other solutions for this problem?