Print Page | Close Window

Validation on navigation properties

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2012
Forum Discription: For .NET 4.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3842
Printed Date: 26-Oct-2025 at 1:30am


Topic: Validation on navigation properties
Posted By: cefernan
Subject: Validation on navigation properties
Date Posted: 07-Dec-2012 at 12:38pm
Hi,

I have the following entities in my database:

Filter FilterCategory
-------------------- --------------------
FilterID FilterCategoryID
Name Name
FilterCategoryID (FK)

* Every property is required.

I have a screen responsible to edit data of Filter. So, when I save a new Filter without filling any field on the screen, I receive a message "Name is required". But, both Name and FilterCategory are required. If I fill just Name, I receive an FK error because of "empty" FilterCategory. 

It's never executed the validation in navigation properties.

Is it possible to do that?

PS: I use database first.




Replies:
Posted By: kimj
Date Posted: 07-Dec-2012 at 4:28pm
See the NullEntityVerifier in this thread - http://www.ideablade.com/forum/forum_posts.asp?TID=2540 - http://www.ideablade.com/forum/forum_posts.asp?TID=2540 .  The thread deals with DF2010, but validation in DF2012 is unchanged (so far).   Using an IVerifierProvider implementation you can add the custom verifier for the navigation property.  More information on custom verifiers here - http://drc.ideablade.com/devforce-2012/bin/view/Documentation/validation-create-custom-verifier - http://drc.ideablade.com/devforce-2012/bin/view/Documentation/validation-create-custom-verifier .


Posted By: cefernan
Date Posted: 10-Dec-2012 at 10:51am
Great Kim.

I created the NullEntityVerifier and customized the DevForce code generation template to mark automatically the navigations as required when necessary.

Thank you.


Posted By: kimj
Date Posted: 10-Dec-2012 at 12:47pm
Excellent!  Thanks for the update.



Print Page | Close Window