Sep 24

Written by: Soul Solutions
Friday, 24 September 2010 

BronwenWeeGo I was trying to add some validation logic into one of my forms. I added a function to my domain data service that I wanted to call from my Silverlight application using an [Invoke] attribute.

It all looked good but every time I tried to call it I kept getting an an error:

Invoice operation [functionname] failed validation. Please inspect ValidationErrors on the operation for details

After pulling my hair out for a bit I realised the entity I was passing into the function was getting validated and ValidationErrors were getting set. This is somewhat annoying.

To get around this for now, what I’ve done is change my function from:

[Invoke]
public bool IsLayerNameUnique(Entity myEntity)

to pass the fields that i need instead e.g.

[Invoke]
public bool IsLayerNameUnique(string name, Guid id)

This now means I can run the function but is somewhat annoying. If I needed to validate a bunch of fields it would mean I’d have to pass them all in.  Anyone got a better way to do this?

Tags:

2 comment(s) so far...

Re: Invoke operation failed validation

This would be very annoying what we want to do and it doesn't work out..what idea you worked with did it work out??? and let me know if u get any other ideas...

By Alex on   Monday, 13 December 2010

Re: Invoke operation failed validation

Your entity myEntity have some field that requiered, but it null???

By dan on   Thursday, 5 May 2011

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 
Copyright © 2002-2009 Soul Solutions Pty Ltd. | Login