In a current Silverlight application we had the scenario where we needed to validate a data form. When the user entered some data, we needed to run some custom validation code against the database to ensure that it was valid.

Unfortunately standard custom validators that you put into a .shared.cs file will not work. As any database logic that you wrote, while working on the domain service side, would not be able to compile on the Silverlight side.

After a LOT of research,  my team came across this blog post by Nikhil Kothari (@nikhilk) that describes how you can write custom validation code that is ONLY executed server side. This allows you to write code that access databases, etc. that cannot be executed client side.

Nikhil also then goes into more details on how you can get client side UI notifications, by adding Asynchronous Validation to the UI.

Here is the link to Nikhil’s blog post http://www.nikhilk.net/RIA-Services-Validation.aspx

By David Burela