Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BO Design
Message
De
27/07/2010 09:22:08
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
27/07/2010 08:21:04
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Divers
Thread ID:
01473986
Message ID:
01474121
Vues:
41
>>>>>Just working through some ideas here, hoping that writing it out will clear it up in my head, or if not, then someone else may give me some feedback.
>>>>>
>>>>>I'm working on some software for an Insurance Company. We have Insurance Policies based on Plans and Plans have Premium Rates which vary according to smoker, age & sex of the Policy Holder and the sum assured of the Policy. For an individual Policy I need to calculate the premium due. So I'll create a CalcPremium() function on the Policy BO. Within this function I need to get the Premium Rate to use. Should I have a GetPremiumRate() function on the Policy BO which pulls the data from the Premium Rate table, or should that be on the PremiumRate BO?
>>>>
>>>>
>>>>Both. in your Policy BO you can instantiate the PremiumRate BO, call a method to return the premium Rate, and then finish your calculation. You should let the PremiumRate business object retrieve the data but there is no reason you can't instantiate that business object from within the first business object.
>>>>Tim
>>>
>>>Thanks Tim,
>>>
>>>I think that's what was bugging me: instantiating one BO within another.
>>
>>Perfectly OK in my opinion. I guess it should be since I do it. :-)
>
>I think what is/was bugging me is that in my VFP framework I would have done this at a level higher than the BO. I use a BOManager that coordinates all the separate BOs and calls the various bits in order to do the calculation.

BOManager doesn't sound like the sort of class where you would want to implement specific code such as that. However if you had several functions that needed to collaborate with different business objects, you could create a class in your business object project that would be the intermediary. The thing to probably watch out for though is keeping from just adding a bunch of un-related stuff in there. You could have a class for instance called PolicyManager that you used to hold methods that would instantiate different business objects to do policy specific work. Nothing wrong with that approach and I have done similar things.
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform