Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use business objects from within a business rule
Message
De
28/02/2005 10:49:39
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, Californie, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00991068
Message ID:
00991194
Vues:
21
Hello Carl,

You can use YourBusinessRule.HostObject property. This stores a reference to the object responsible for creating YourBusinessRule object. One thing to keep in mind, though, is that this reference is stored as ImmBusinessRuleHost type. IOW, you'll have to cast it to your business object for access to the custom methods you're probably looking to implement.

For references to other/multiple objects, you're best off creating them from within the business rule object. We've also used mmBusinessProcess to coordinate multiple business objects' methods.

Hope that helps,
---J

>How would I call one or more business objects from within a business rule class? There are some cases where data validation is based on a number of conditions that can only be determined by using other business objects accessing different database tables. For instance, I want to do something like this within business rule:
>
>
>Public Function ValidateCreditRating(ByVal creditRating As String, ByVal creditCode As String, ByVal customerID As Integer) As String
>        Dim message As String = Nothing
>        ' check rating
>        If creditCode = "Z" Then
>            Dim ratingGood As Boolean
>            ratingGood = Me.oCreditCheck.CheckRating(creditRating, customerID)
>            If ratingGood = False Then
>                message = "Credit rating too low."
>                Me.AddErrorProviderBrokenRule("CreditRating", message)
>            End If
>        End If
>        Return message
>    End Function
>
>
>A bit of a cheesy example, but hopefully it gets the idea across. Unfortunately, I get an object not referenced error when I try to do the something like the above.
>
>Any ideas?
>
>Regards,
>Carl.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform