Print Page | Close Window

Custom validation example

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3624
Printed Date: 05-May-2024 at 3:40am


Topic: Custom validation example
Posted By: siko
Subject: Custom validation example
Date Posted: 12-Sep-2012 at 5:58am
Hi,

I'm a bit confused on how to implement the following 'business rule':

What:
An assessment cannot be saved if there is already an assessment for a certain date, applicant and assessment-type. (assessment, applicant, assessment date are 'unique'). We might in the future have to add 'for a certain user domain/organization' ... so we don't think of solving this with an unique index on db level.

How:
Validation rule. With other words, find async the assessment with the same date, applicant and assessment-type as the assessment to be saved and returns 'all good' if none found.

With what:
Here it becomes a bit blurry. It seems the Verifier route is the way to go. But I get stuck Finding the assessments async.
And I don't really get if the EntityServerSaveInterceptor is the place to do this check.

Any help would be appreciated!



Replies:
Posted By: mgood
Date Posted: 12-Sep-2012 at 7:55am
The way to go here is a validation service that can be called asynchronously by the ViewModel before allowing the user to save.
This scenario is discussed here:
 
http://drc.ideablade.com/xwiki/bin/view/Documentation/unit-of-work-pattern-and-persistence-ignorance#HDomainService - http://drc.ideablade.com/xwiki/bin/view/Documentation/unit-of-work-pattern-and-persistence-ignorance#HDomainService
 



Print Page | Close Window