Where/how is the proper way to code this business logic using the WSSF model

Jun 22, 2007 at 11:31 AM
I am trying to figure out where and how to code the business logic. Example: an object get's approval. Upon approval certain fields in the record are updated, other records in other tables are generated, and emails are sent. This amount to a series of calls to the DataAccess classes (SelectionFactory, InsertFactory, etc.) and some interaction with mail. I expect this method would then be exposed as a service. I think I need to create a new class in BusinessLogic, create a static method (Approve) that takes one argument (the object which is being approved). Does that sound correct?
Developer
Jun 22, 2007 at 11:54 AM
You can take as a guidance the sample in the Hands-on Lab where your can find a business logic class that drives the call to the repository and handles the response to the service.
An example of this class is like this:

public class RegistrationManager
{
    public RegistrationResult RegisterClubMember(ClubMember member)
    {
        ClubMemberRepository repository = new ClubMemberRepository("CohoWinery");
        repository.Add(member);
 
        RegistrationResult result = new RegistrationResult();
        result.ConfirmationCode = 982734982;
        result.MemberNumber = member.MemberNumber;
 
        return result;
    }
}
So basically you endup with somthing close to your suggestion.
Jun 26, 2007 at 6:19 PM
One thing that you can see in the reference implementation, is that you are supposed to use the repository to access your data layer, which means you wont be calling directly the selection, insert, etc factories.