Geeks With Blogs
Scott Kuhl Warning: I may have no idea what I am talking about!

There are two places that business rules can be injected into the Save process.  A PreUpdate method is called at the beginning of the Save process and a PostUpdate method is called at the end.  Both of these methods are virtual methods defined in each class that take no parameters and have no return value.  To define these methods, create a partial class file with the same name as the class.

public partial class Product
{
    protected override void PreUpdate()
    {
       
// Do something
    }

    protected override void PostUpdate()
    {
        // Do something
    }
}

This is an easy way to add simple authorization, validation and business rules.  If you need more flexibility, check out the Controller pattern implementation discussed later in Conventions.

Find the entire series of posts here.

Posted on Wednesday, December 6, 2006 10:34 PM SubSonic | Back to top


Comments on this post: Getting Started with SubSonic - Part 11, Classes - Business Rules

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Scott Kuhl | Powered by: GeeksWithBlogs.net