Sam

Feb 2, 2012 at 3:06 PM
Edited Feb 2, 2012 at 3:06 PM

I have implimented the RequiredIf on a property like this:

[RequiredIf("FAC_RECALL", "Yes", ErrorMessage = "FAC RECALL DESC is required if FAC RECALL is set to yes")]
public string FAC_RECALL_DESC { get; set; }



I have it working on the client side with the Proper error message through foolproof unobtusive JavaScript.

And when it comes back from the server I get the Server side same message.
Everything is good up to this point.

But once my whole Create Form is valid, I get an exceptioin at Entity Framework SaveChanges():

 DbUnexpectedValidationExeption was unhandled by user code.
An unexpected exception was thrown during validation of 'FAC_RECALL_DESC' when invoking Foolproof.RequiredIfAttribute.IsValid. See the inner exception for details.

InnerException: The method or operation was not implimented

I think it something to do with SaveChanges() calling IsValid() and not being able to find it.

Has anyone else run into this and has it been solved?

I really need this to work.