New Posts New Posts RSS Feed: Validation on navigation properties
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Validation on navigation properties

 Post Reply Post Reply
Author
cefernan View Drop Down
Groupie
Groupie


Joined: 13-Jul-2012
Posts: 70
Post Options Post Options   Quote cefernan Quote  Post ReplyReply Direct Link To This Post Topic: Validation on navigation properties
    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.

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 07-Dec-2012 at 4:28pm
See the NullEntityVerifier in this thread - 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.
Back to Top
cefernan View Drop Down
Groupie
Groupie


Joined: 13-Jul-2012
Posts: 70
Post Options Post Options   Quote cefernan Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 10-Dec-2012 at 12:47pm
Excellent!  Thanks for the update.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down