﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Multiple BO instances with a BBS</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 15 Sep 2026 17:48:05 GMT</lastBuildDate><ttl>20</ttl><item><title>Multiple BO instances with a BBS</title><link>http://forum.strataframe.net/FindPost21150.aspx</link><description>In a recent email&amp;nbsp;conversation with Trent, he told me that a BBS creates a shared data table and then exposes a unique instance of the BO for each row using the shared data table.&amp;nbsp; Now, this poses a problem for me that I'm unsure of how to solve.&amp;nbsp; Consider the following scenario:&lt;/P&gt;&lt;P&gt;Public Class BO1 &lt;BR&gt;&amp;nbsp; Private SubBO1 as New BOType&lt;BR&gt;&amp;nbsp;&lt;BR&gt;&amp;nbsp; Public ReadOnly Property SomeProperty &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return SubBO1.Property&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Get&lt;BR&gt;&amp;nbsp; End Property&lt;/P&gt;&lt;P&gt;&amp;nbsp; Public Sub FillAll()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.FillDataTable("SELECT * FROM MyTable")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubBO1.FillAll&lt;BR&gt;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp; Private Sub BO1_Navigated(.....) Handles Me.Navigated&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SubBO1.SeekToPrimaryKey(Me.SubBO1Key)&lt;BR&gt;&amp;nbsp; End Sub&lt;/P&gt;&lt;P&gt;End Class&lt;BR&gt;&lt;BR&gt;&lt;/P&gt;&lt;P&gt;So basically what I've done is created an instance of a SubBO that I want to use inside of the BO1 i'm creating.&amp;nbsp; As the BO1 row changes, I want to seek to a different row on SubBO1 so that I can easily access properties from that BO with the best performance and lowest amount of memory usage.&amp;nbsp; This works fine until I use this BO with a BBS.&amp;nbsp; Once a BBS is used to make this a data source,&amp;nbsp;it causes errors.&amp;nbsp; Basically what appears to happen is that a lot of instances of the BO get created, but the DataTable isnt in sync somehow.&amp;nbsp; When it goes to Seek on the navigated event, there is nothing in the data table for the SubBO1.&amp;nbsp; It looks&amp;nbsp;like the BO instances are created for each row and share the CurrentDataTable, but dont have the SubBO1 DataTable shared among them.&amp;nbsp; I can solve this by making the SubBO1 Shared, but I dont really want it to be shared because this approach has been causing me some memory issues.&amp;nbsp; Is it suggested practice when using a BBS to make any BO instances inside of your source BO Shared?&amp;nbsp; I guess I'm asking what the best approach is in this situation.&amp;nbsp; And, if I do need to make it shared to prevent this problem, what is the proper way to dispose of a shared BO isntance?</description><pubDate>Fri, 12 Dec 2008 11:36:01 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Multiple BO instances with a BBS</title><link>http://forum.strataframe.net/FindPost21166.aspx</link><description>ok, so then&amp;nbsp;can i get the version of StrataFlix that goes with the version of the dlls&amp;nbsp;I have?&amp;nbsp; Please &amp;nbsp;:D</description><pubDate>Fri, 12 Dec 2008 11:36:01 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Multiple BO instances with a BBS</title><link>http://forum.strataframe.net/FindPost21164.aspx</link><description>Yes, in the reports.</description><pubDate>Fri, 12 Dec 2008 11:17:10 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Multiple BO instances with a BBS</title><link>http://forum.strataframe.net/FindPost21162.aspx</link><description>We are a vb.net shop.&amp;nbsp; Does the StrataFlix sample you were talking about use the method you are referring to?</description><pubDate>Fri, 12 Dec 2008 10:36:25 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Multiple BO instances with a BBS</title><link>http://forum.strataframe.net/FindPost21160.aspx</link><description>[quote]However, the child BOs DataTable is not shared and therefore is empty for all instances created after the&amp;nbsp;original instance of the parent BO.&amp;nbsp; [/quote]&lt;/P&gt;&lt;P&gt;It doesn't have to be.&amp;nbsp; You can programmatically change the child to use a shared data table as well.&amp;nbsp; Then it would work as you are trying to make it work.&amp;nbsp; We generally take a different approacha nd use the BusinessLayer.FillMultipleDataTAbles method in cases like this to populate the parent BO and all of the children at the same time (can drastically improve loading performance).&amp;nbsp; Then we will filter out the child records when referenced through the parent BO.&amp;nbsp; It is a different approach than you are trying to use, but it will be faster and you won't have to take the route you are currently taking.&lt;/P&gt;&lt;P&gt;I forget, are you a VB or C# shop?</description><pubDate>Fri, 12 Dec 2008 09:38:39 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Multiple BO instances with a BBS</title><link>http://forum.strataframe.net/FindPost21153.aspx</link><description>I'm sorry, I completely ignored the part of the response where you offered to give me the new StrataFlix project.&amp;nbsp; That would be great.&amp;nbsp; Can you email it to me?</description><pubDate>Thu, 11 Dec 2008 20:16:51 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Multiple BO instances with a BBS</title><link>http://forum.strataframe.net/FindPost21152.aspx</link><description>The problem doesn't seem to be that the CurrentRowIndex isnt working properly.&amp;nbsp; The problem is really that the DataTable is only being filled for the first instance of the parent BO and is then shared for all other instances.&amp;nbsp; However, the child BOs DataTable is not shared and therefore is empty for all instances created after the&amp;nbsp;original instance of the parent BO.&amp;nbsp; &lt;/P&gt;&lt;P&gt;The fill method is where I am filling the parent and child BOs, but since the child BO doesn't have a shared data table like the parent it is not getting filled.&amp;nbsp; The solution has been to create these child BO instances as shared BOs, but my question is how to dispose of them properly if I use this method.&amp;nbsp;</description><pubDate>Thu, 11 Dec 2008 20:14:49 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Multiple BO instances with a BBS</title><link>http://forum.strataframe.net/FindPost21151.aspx</link><description>Well, I would suggest a slightly different approach.&amp;nbsp; We too have child BOs in which we want to line up with the parent.&amp;nbsp; If you look at the StrataFlix sample you will see exactly how to achieve this.&amp;nbsp; But in short, you will create a Custom BBS that wraps the child bo, then inside of the parent BO (not the BBS) you will create the instance of the child BBS and expose it through a property.&amp;nbsp; The Custom BBS template will do this for you if you use it.&amp;nbsp; Then in the Get of the exposed ChildBO you will apply a filter.&lt;/P&gt;&lt;P&gt;But let's back up here for a minute anyway.&amp;nbsp; The example you gave showed concerned of the CurrentRowIndex not reflecting the proper instance.&amp;nbsp; Well, that isn't true.&amp;nbsp; The CurrentRowIndex is also shared between the collection.&amp;nbsp; So technically you should not have an issue there as well.&amp;nbsp; Finally, if you want to expose this, there are a number of other options.&amp;nbsp; If you have BaseBO that all of your BOs inherit from, you can set a flag and/or a property that gives you the instance of the BBS and then you have ultimate control.&lt;/P&gt;&lt;P&gt;You started using BBS instances prior to the CustomBBS class being released.&amp;nbsp; But I would highly recommend looking at the StrataFlix sample and the reporting BBS and BOs that is shows.&amp;nbsp; Since you have a pathced assebmly, I can send you the recompiled version of the StrataFlix sample.&amp;nbsp; Let me know when you are ready.</description><pubDate>Thu, 11 Dec 2008 19:49:29 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>