Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I reference a BizOject’s child BizObject?
Message
 
To
11/08/2003 12:11:47
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, California, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00818503
Message ID:
00819014
Views:
12
Jason and Brian,

Thanks Jason for catching this. You do need to cast the HostObject to the parent Business Object. However, the translated code to VB will not work due to syntax differences in the language. Here is the translated code that "should" work:
Dim loClient as Client

loClient = CType(Me.HostObject, Client)

Dim oBizObj As MyChildBizObj = CType(loClient.RefBizObj.Get(GetType(MyChildBizObj)), MyChildBizObj)
>Brian,
>
>I have a feeling this is due to HostObject not having a RefBizObj. Remember, HostObject is merely a reference to an object that hosts the ImmBusinessRuleHost interface. Not all compliant objects (mmBusinessEvent for example) have a RefBizObj collection. For this to work, you'll have to cast HostObject to mmBusinessObject or one of its subclasses:
>
>(Sorry, not quite fluent in VB.NET, but I'll give it a shot <s>)
>
>
>Dim loContact as Contact
>Dim loClient as Client
>
>loClient = (Client)me.HostObject;
>
>///Now that you've cast loClient to a subclass of mmBusinessObject, typing "loClient." should bring RefBizObj in your Intellisense.
>oCOntact loCOntact = (oCOntact)loClient.RefBizObj.Get(typeof(oCOntact));
>
>
>I also noticed while typing this that your example has "oContact" in your call to typeof(), and "oCOntact" in the rest of the code. That will definitely bite you as well!
>
>Hope that gets you on the right track,
>---J
>
>>Cathi,
>>Did you run code similiarto your sample? I've tryed every consevable varyation and it wont work. Is the sample c#? HostObject.RefBizObj doesn't show up via intelli senese.
>>the code below is one way I tryed it, but this wont run.
>>the referance I'm creating loCOntact, The Rules host oClient, oClients child is oContact
>>
>>
>>Dim loContact as Contact
>>oCOntact loCOntact = (oCOntact)me.HostObject.RefBizObj.Get(typeof(oContact));
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform