Print Page | Close Window

Is there any event that EntityManager raises on Validation Completed?

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=3068
Printed Date: 26-Jan-2026 at 4:04am


Topic: Is there any event that EntityManager raises on Validation Completed?
Posted By: katit
Subject: Is there any event that EntityManager raises on Validation Completed?
Date Posted: 31-Oct-2011 at 8:26am
I'm working on creating user control to display DevForce Verification results on my silverlight views.
DevForce supports INotifyDataErrorInfo and it works great to display errors that associated with certain fields. This part works great.
 
It doesn't work when I have form-level validation (entity level) and it doesn't work when I have validation level set to anything but error.
 
Solution is to create my own control to display all results but I need some kind of hook so I know when errors change..



Replies:
Posted By: DenisK
Date Posted: 31-Oct-2011 at 6:59pm
Hi katit;

Have you tried using VerifierBatchInterceptor?  http://drc.ideablade.com/xwiki/bin/view/Documentation/intercepting-a-verifier - http://drc.ideablade.com/xwiki/bin/view/Documentation/intercepting-a-verifier


Posted By: katit
Date Posted: 01-Nov-2011 at 11:09am
Denis,
 
I look at it but not sure how I integrate it. Do you have code sample?
 
I use Repositories to abstract EntityManager and data from my ViewModels. Ideally, I'd like to have repositories to raise event for me so I can use it in my VM. So, I need to know when specific instance of EntityManager does validation.


Posted By: DenisK
Date Posted: 01-Nov-2011 at 6:55pm
Hi katit;

Here's the link for the code sample.  http://www.ideablade.com/friends/SimpleBatchInterceptorCodeSample.zip - www.ideablade.com/friends/SimpleBatchInterceptorCodeSample.zip

I'm taking an existing SL Validation code sample and adding a simple BatchInterceptor to it. Hopefully it can illustrate to you what it does. You can think of the BatchInterceptor as an event that is raised each time a validation (property level or entity level) is executed.

Basically what the sample does is load all employees and their respective orders onto a data grid. As soon as the employees are fetched, I'm calling 

_mgr.VerifierEngine.Execute(_employees[0]);

to execute an entity level validation on the first employee. Put your breakpoint under MyBatchInterceptor to see how the event is raised for each of the property's validation that gets executed.

Hope this helps.


Posted By: katit
Date Posted: 01-Nov-2011 at 8:57pm
Thanks! Looks good, Should work for me



Print Page | Close Window