By Chan - 11/25/2008
Hi,
I have a form contains two business objects. I used ASPxGridView to bind to WebBBS which attach CHildBO. In Page_Load, I have code to set ChildBO.ParentBusinessObject = ParentBO if !IsPostback.
I am facing problem that, whenever I add new record to ASPxGridView, WebBBS.CreateShareAndAddBusinessObject() would be fired. In this method, it will clone the ChildBO; assign ChildBO.ParentBusinessObject to ClonedBO.ParentBusinessObject.
Whenever this happens, program try to access the ParentBO instance and add ClonedBO to its ChildBusinessObject collection. As all BOs are stored in Session, it cause existing ParentBO.ChildBusinessObjects retain and keep been added new ClonedBO.
It caused some error for that if I loop thru ParentBO.ChildBusienssObjects to do something.
Please advice.
|
By Chan - 11/28/2008
Hi,
After further debugging, I found that, SF create multiple instance of BO in order to support "Enumerator". It is understandable. However, it caused multiple instance of same BO class in ChildBusinessObjects.
Currently, I try to loop thru ChildBusinessObjects and check for its TableName in order to get "distinct" list. However, it is not bullet proof as if that is a need to have same BOs (diff instance) in same web page would cause another issue as well.
Please advice.
Thank you
|
By Govinda Berrio - 12/1/2008
I've found the a very similar issue. If I set the ParentBusinessObject on a BO in the Page_Load (!IsPostBack) after a postback, the ParentBusinessObject child collection has new duplicated entries of the same child BO. I've been meaning to create a sample project to demonstrate this, but I haven't gotten around to it yet.
|
By Govinda Berrio - 12/1/2008
I should also note that both the Parent and Child BOs are declared in the BasePage
|
By Trent L. Taylor - 12/1/2008
I could see how this might happen, but I have not been able to reproduce. If possible, could you please post a quick sample showing how to reproduce this so that we can see this in action. Once we can reproduce this things will move much faster. Thanks!
|
By Chan - 12/2/2008
Hi,
Please download sample project from http://www.visualsolutions.com.my/blog/chankk/WebApplication2.zip.
Set breakpoint at line Me._BusinessObjectList.Add(index, loReturn) of BusinessBindingSource.CreateShareAndAddBusinessObject() method.
Run the project, click new button from ASPxGridView, key in value and click "Update" link.
Use watch window to check the value of loReturn.ParentBusinessObject.ChildBusinessObjects.Count when debugger hit that line.
You would find that, it keep increasing everytime new record added.
Please advice, urgent!
Thank you
|
By Dustin Taylor - 12/2/2008
Chan,We downloaded your sample and ran through it, but I'm not seeing the point of failure. Could you provide some additional information? After wiring up your sample to work in our environment, I run your app and end up with a grid with a single record in it (the bottomost record from the database). After clicking new, I enter valid values into all fields and click update. The original grid is then populated with a single record containing my specified values. These values are not being saved back to the server (I assume a save is not being called here?). Regardless, the ChildBO count label stays at 1 which, as I understand it, is your point of failure. Where are you placing your breakpoint? Do you intend for the data from a new record to be saved on the SQL server? Is your childBO issue being reflected by your label on your end?
|
By Chan - 12/2/2008
Hi,
Sorry for misleading, the label would not be refreshed anyway.
As mentioned in previuos post, I placed breakpoint at line
'-- Set the parent business object of the instance object
loReturn.ParentBusinessObject = _BusinessObject.ParentBusinessObject
'-- Add the object to the list
Me._BusinessObjectList.Add(index, loReturn)
of BusinessBindingSource.CreateShareAndAddBusinessObject().
The data would not be saved to database as we need to call BO.Save manually.
I also uploaded video to show the behavour. http://www.visualsolutions.com.my/blog/chankk/bbs.zip
Please advice. urgent!
Thank you
|
By Chan - 12/4/2008
Hi,
May I know if SF team is checking on it?
I need it to be solve urgently.
Please advice.
Thank you
|
By Chan - 12/10/2008
Hi,
May I know any status updated? Are you overlook this issue?
I need to fix it ASAP as it seem to cause memory leak.
Please help!!!
Thank you
|
By Trent L. Taylor - 12/11/2008
Chan,We have sent this through 3 different developers hands and we have not yet recreated your problem. I believe the problem that you may be experiencing has already been fixed but not released to the public at large. So let's recap a few things on how the BBS actually works. A unique instance of a BO is created for each row that is shown within the result set. Each of these unique BO instances inside of the BBS uses a shared data table. So there is only a single copy of data. This is done intentionally and is no different than a collection with item objects internally. However, we did recently fix a bug where the BBS was not releasing all of the handlers of the internal BOs which could cause a memory leak under certain conditions. We have released this only to a couple of customers and we will release to all in the next 1.6.7 beta. The reason we have not released this to all is because all of the partials of the business objects will need to be rebuilt. We will send you a copy of this build sooner than the initial release, but it will probably not be until the end of this week or the beginning of next week so that we can go back in source history and see if we can actually reproduce your problem to see if this will actually address it.
|
By Chan - 12/19/2008
Hi,
Any update?
Thank you
|
By Trent L. Taylor - 12/19/2008
Yes. The status is the same in regards to my previous post. We are going to post a new beta in the next week or so which will have a number of nice new tidbits as well as help us work through any remaining issue you have here. Thanks for your patience on this.
|