Print Page | Close Window

Verify Navigation Properties

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3046
Printed Date: 23-Jan-2026 at 12:28pm


Topic: Verify Navigation Properties
Posted By: CaptainOrgange
Subject: Verify Navigation Properties
Date Posted: 20-Oct-2011 at 4:08am
Hi.
 
I am trying to verify my properties before calling the Save method. I do this be ensuring the the object belongs to the EntotyManager, then I call the VerifierEngine.Execute() method. This works great for entities having no navigation properties.
 
As an example. I have a Person model, and a Car model. My Person model can have allot of cars,and a Car can only have one Person, i.e. The Person is a Navigation Property for the Car Model. 
Now I want to have a quick admin screen, where you type the person name,surname and the car make and model. Then the application should save the Car and the Person. This I got working. But now I want to validate before the EntityManager.Save is called, how can I do this.
 
When I try to validate the Car is validated //** VerifierEngine.Execute(instance of car) **/, but the Person properties is not verified. But when I call EntityManager.SaveChanges, then the Person is validated, i want to do this before the save.
 
Any ideas welcome
 
 

 




Replies:
Posted By: sbelini
Date Posted: 20-Oct-2011 at 12:34pm
Hi CaptainOrgange,
 
You could execute the verifier engine against the Person as well:
 
VerifierEngine.Execute(aCar)
VerifierEngine.Execute(aCar.Person)
 
Regards,
   Silvio



Print Page | Close Window