Validation When Using MVVM (WPF) with a DDD-Based Model -


a common mvvm/wpf approach data-bind ui's controls directly underlying model object. model object may contain own validation logic (perhaps exposed via idataerrorinfo) or may validated helper class checks model object instance errors. in either case, @ times model have invalid data in , in invalid state.

however, in ddd world, model never in invalid state. how suggest performing validation when using wpf , ddd?

thanks,
ben

i don't think view in mvvm should binding directly domain model, should binding view model instead. view model can in "invalid" state can reflected through idataerrorinfo. later when user operation (e.g. save, ok, apply) applies underlying domain model should domain model enforce validity, can prevent apply not allowing operation in ui.

although must i've found it's not easy without duplicating validation logic extent.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -