CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Business Validations

rated by 0 users
Not Answered This post has 0 verified answers | 1 Reply | 1 Follower

Not Ranked
5 Posts
tanny posted on Fri, May 11 2012 9:57 AM

All,

I'm newbie to CSLA and I'm trying to implement validations in my application (Business layer -> CSLA). I have requirement where in batch application we would check the data in DB against some business conditions and perform appropriate business logic accordingly. Later when these data entities are viewed from the screen, the same appropriate validation message needs to be displayed in the screen as well.

I'm just in initial approach phase, where I'm thinking if its required to store the appropriate validation message against that data entity or use the Business validation rules in CSLA for the same.

If in CSLA, can someone please share me some samples on business validation rules?

Thanks!

Regards,

Tanny

All Replies

Top 10 Contributor
1,772 Posts

Hi,

CSLA does NOT support the idea of storing broken rules in the database and restoring them as part of the fetch operation later.

BusinessRules is a lot more than just validation and broken rules so you should run all your Business Rules when you fetching the Editable object.
You _could_ save broken rules to a database and just load as an information string property on a readonly object but it would not be recommended by me.

You should be aware that Broke Rules can be

  • a object level or
  • property level
  • may be more than one for object or property
  • can be any level of Error, Warning or Information

For samples look at the UsingCsla4-02-Objects ebook available for purchase at http://store.lhotka.net and the samples download projects

\Samples\Net\cs\RuleTutorial
\Samples\Net\cs\BusinessRuleDemo
\Samples\Net\cs\ProjectTracker

So my recommendation is:

1. If batch processing is time / performance critical - do the checks in the database if possible. That will always give the best performance.

2. Create/Add Business rules to CSLA entities to run when you load objects for edit. 

Jonny Bekkum, Norway CslaContrib Coordinator

Page 1 of 1 (2 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems