StrataFrame Forum

Accessing BBS Instance of the Business Object

http://forum.strataframe.net/Topic17697.aspx

By Ertan Deniz - 7/7/2008

How can I access the BBS instance that wraps my business object at runtime ?
By Aaron Young - 7/7/2008

I doubt your question can be answered as easily as this but you can access a BBS directly in code. The following C# code allows you to call the BOs MoveFirst method through the BBS:-

myBBS.BusinessObject.MoveFirst();

A BBS points at the BO but the BO doesn't point at the BBS. So if you are trying to take an unknown BO at runtime and locate it's BBS then you could use .NET Reflection if you can work out the BBS name from the BO name. For example, if your BOs are named as "customerBO", "productBO", etc. and your BBSs are named "customerBBS", "productBBS" then you can work out the BBS name at runtime from the BO name and use .NET Reflection to access the properties on the BBS. Reflection is not as fast as accessing the BBS directly in code (as above) but it will be faster than scanning through all form objects searching for the BBS.

Aaron

By Trent L. Taylor - 7/8/2008

If you will use the new Custom Business Binding Source the internal BO is exposed through the SourceBO property.  You must be on the most recent 1.6.6 beta build, but this will handle a vast majority of the logic that I think that you are trying to code manually at the moment.  There is a new template for this as well when you add a new item (Custom Business Binding Source).  Then in code you can access it like this:

Talking to the strong-typed properties

MyBBS.SourceBO.cust_LastName;

Talking to the standard BO methods

MyBBS.SourceBO.MoveFirst();