Silverlight TV 18: WCF RIA Services Validation

Play Silverlight TV 18: WCF RIA Services Validation
Sign in to queue


Just prior to MIX10, Nikhil Kothari appears on the show to demonstrate some of the key advantages around validation when using WCF RIA Services. He demonstrates how to use a Domain Service to expose your domain model and how to create a custom service method to further filter your data server side. Nikhil also shows how the Domain Services generates validation rules using the database attributes such as required fields or maximum string lengths. Other topics Nikhil covers:

  • Domain service generated services and validation
  • Custom service methods
  • Adding your own validation attributes
  • Creating custom validation methods for server and client
  • Creating cross property validation in an entity
  • Creating server only validation that may be called asynchronously from the client
  • Showing validation errors to the user

Relevant links:

Follow us on Twitter @SilverlightTV 



Download this episode

The Discussion

  • User profile image
    Ben Hayat

    John, you ask great questions, as if you could read my mind Smiley

    Nikhil, thank you for great show. Hope to see more of you here. Love to have the code for this show. Need to check a couple of things against the code.


    Thanks guys (Gentlemen) Smiley


  • User profile image

    Ben - Thanks, glad you liked it. You can get the code from Nikhil's blog post righ here:

  • User profile image
    Ben Hayat

    Ya, but that code is for the MIX and not this show. He just told me that he may not have the code, since it was on a laptop image and he is not sure he has it. This was a great show. I hope the presenters don't get frustrated with you stopping them, but you break down very important points that the presnters go over quickly. Man, you should have joined MS in 2007 Smiley Dr. Sneath picked a good one. I bet Disney is upset Smiley




  • User profile image

    Great episode, answered a lot of questions I had.  But, please, please post the next video soon, validation based on volatile rules from a database is exactly what I want to know!

  • User profile image

    Great ep, also very interested in the validation based on db/xml rules.

  • User profile image

    Ben - Thanks for the head sup. Nikhil just updated his blog post with the code from this episode.


  • User profile image


    PerfectPhase & Chooksy - I'll see if I can line up an episode showing how to do DB or XML driven validation. Thanks for the interest!

  • User profile image
    Atif Shahzad

    I like RIA Services but i have only one question why XAML designer is not availabe in Vsial Studio 2008 for RIA Services please convey my message to Microsoft beacause i don't want to purchase Visaual studio 2010 now , but i want to develop my future application on RIA services please tell me is there any solution to view XAML designer for RIA services in Visual Studio 2008, because without designer i think its useless to use RIA Service in VS 2008.




    Atif Shahzad

  • User profile image
    Ben Hayat

    >>Thanks for the head sup. Nikhil just updated his blog post with the code from this episode.



    Except that the link is broken Smiley

    I just left Nikhil a message on his blog;


    thanks for keeping alert attentions!

  • User profile image
    Ben Hayat



    This issue goes back to several months ago where the RIA team had to move forward with some new features that were introduced in .Net 4 and WCF4.0. Also, VS10 has new capabilities for rendering XAML that is not available in VS2008.

    RIA services RC/RTW basically depends on certain elements that are only in .Net 4 and VS10 and it's beyond RIA team when it comes to these requirements. So, RIA had no other choice!


    My humble suggestion (and it's a good suggestion) to move to VS10 and new RIA and new WCF4.0 and EF4.0. You'll be better off!

    Note: I don't speak on behave of Microsoft or RIA team, just my own suggestion.


    Good luck!

  • User profile image
    Ben Hayat


    The link to the sample code is fixed and working;
    Thanks Nikhil!



  • User profile image

    Yes, Ben is right.... SL4 targets VS 2010 and .Net 4.0 and not VS 2008

    this was not a thing that MS wanted to force on us... it was just not really possible / worth the re-doing of VS 2008 to make it work.

    on the plus side if you get vs 2010 you can still maintain projects that target .net 2.0 and 3.0 and 3.5 so it's not like you have keep both versions and switch back and forth ....

  • User profile image
    Atif Shahzad

    Thanks Ben Hayat so i have to ship on VS2010.Smiley  

  • User profile image

    They removed the XAML designer in 2008 because of stability and performance issues,

    they will not be adding it again... unless they release an SP2 which is unlikely

    (This only applies to silverlight, not to WPF)

  • User profile image
    Ben Hayat

    Yes, you're much better off to deply based on WCF 4 and EF 4, which are both used with RIA RTW and VS10;


    I stayed with RIA PDC (.net 3.5/vs2088) until MIX, but now they are all in sync and the RTW of SL4, RIA, .Net all happening in April. Time to move on.


    Good luck with your move!

  • User profile image

    Validation is always one of the tasks i dred. This makes things alot more streamlined.. good work.

  • User profile image



    Can this example be considered as blue-print of MVVM in SIlverlight?

    If not, what changes will you consider to make it like one?

    I am struggling to understand the use of ProductEditTask and Product partial classes.


    If MainPageModel is used as VM for MainPage, then couldn't it have contained all the operations in ProdctEditTask class?


    Any explanation will be really helpful.


Add Your 2 Cents