Silverlight tip: server side RIA services custom validation

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s