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

Installing Silverlight 4 tools with Visual Studio 2010 RC

With the release of Visual Studio 2010 RC I was disappointed that the Silverlight team hadn’t released an updated tools installer <Insert theories of the team waiting for Mix2010 to release an updated installer>.

I was forwarded to this website which explains how to install the Silverlight 4 tools for Visual Studio 2010 Beta 2 onto Visual Studio 2010 RC http://translate.google.com/translate?hl=en&sl=auto&tl=en&u=http://sorokoletov.com/2010/02/hate-2-wait-silverlight-4-beta-2-vs-2010-rc/

It comes down to

  • Extract the SL4 installer
  • Modify the .xml file to enable it to install
  • Modify the registry
  • Replace one of the RIA .dlls with a patched version.

By David Burela