Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using IDataErrorInfo in M-V-VM

If my domain objects implement IDataErrorInfo, and I am using M-V-VM, how do I propagate errors through the ViewModel into the View? If i was binding directly to the model, I would set the "ValidateOnExceptons" and "ValidateOnErrors" properties to true on my binding. But my ViewModel doesn't implement IDataErrorInfo. Only my model. What do I do?

Clarification I am dealing with an existing codebase that implements IDataErrorInfo in the domain objects. I can't just implement IDataErrorInfo in the my view model.

like image 711
Micah Avatar asked Dec 04 '08 19:12

Micah


1 Answers

You can implement IDataErrorInfo additionally in your VM and route the calls to the VM to your corresponding domain objects. I think this is the only way without exposing domain objects directly to the view.

like image 178
MarioH Avatar answered Sep 29 '22 12:09

MarioH