Client and server validation
I'm developing application that use nHibernate for ORM, WCF services and silverlight as UI. My question is how to provide validation on server and also on client for domain entities. I thought using nHibernate validation framework but not sure if I can use it as client (silverlight) validation. I 开发者_JS百科don't want to have two codes of validation and like to use nHibernate validation. Any idea?
Tnx!
You'r validation can be handled by a ViewModel implementing INotifyDataErrorInfo interface. And that interface also provides the grounds you need for building your own asynchronous validation which will be needed for server side validation.
That's what the WCF RIA Services and the System.ServiceModel.DataAnnotation attributes can be used for.
Also, for more complex validation scenarios and also validation driven by external config, take a look at the Validation Application Block (which is part of the Enterprise Library Silverlight Integration Pack) useful.
精彩评论