Saving Not being called IN BindingListBase(Of Items, Item)

Saving Not being called IN BindingListBase(Of Items, Item)

Old forum URL: forums.lhotka.net/forums/t/9639.aspx


vbbeta posted on Thursday, October 14, 2010

I have this odd thing behavior in my BB

When the BB IsNew then the insert works just fine saves all the BusinseBase(of xyz) objects and the BUsinessBindingList(Of) but when temp = Transaction. Save is called and then i add new items to the binding list of items all the settings is just fine IsDirty on the proper objects is being set to true and the IsNew is being set to true If necessary and the override in the parent object works also fine but the call to save to the Method in the Parent class doesn’t work even though the IsDirty is true

Then I tried to pass in a parameter in the save Method to base.save (True) then i get the stackOverfllow which sounds to be a bug that the an error accord in "Csla.dll" and stackTrace says not able to evaluate the error

please if any info just let me know

RockfordLhotka replied on Thursday, October 14, 2010

The overload of Save you are calling is to force an update instead of an insert. It is designed to support web and service scenarios with a stateless server.

But it isn't intended to support a root level list, because a list is never inserted, it is only ever updated. BusinessListBase only has an update operation, which loops through the child objects to insert/update/delete them based on their state.

In fact, the forceUpdate parameter never affects any child objects, only the root. It is entirely up to you to make your child objects have the correct state.

And that's not normally a problem in the web or service scenarios, because you usually don't have child objects - at least not in the same way you do with a smart client. That's just due to the stateless nature of the web.

vbbeta replied on Thursday, October 14, 2010

Thanks rocky for the response

By the way I’m 1 of the clients that didn't wait to get your valuable training product I just bought it when the price was still hi

 

Anyways I see the think about not passing in the overload but, what about the question I had in the post about the save of the root is not being saved even though the IsDirty property is turned on, why is save method not being triggered

 

RockfordLhotka replied on Friday, October 15, 2010

I guess I don't understand what you are saying then.

You override Save and call base.Save(true), but Save is never called? If that is what you are saying then it sounds like a bug in your UI code.

vbbeta replied on Friday, October 15, 2010

I guess I didn’t explain what my problem is.

 Let me explain you the whole scenario I have a class that contains transaction “BB(Of Transaction) and each transaction has a list of items and each item that is being entered in the BLB(Of Items, Item) should be saved when I’m calling the save from the Transaction class

So when the transaction is new then the save method works just fine but as soon the Transaction with its child objects is being inserted the save method is no longer working even though I override the IsDirty property to be Mybase.IsDirty OrElse items.IsDirty  the DataPortal_Update is not being invoked for some reason  

 

RockfordLhotka replied on Friday, October 15, 2010

If you are using managed backing fields for your child references, all this should be entirely automatic. You shouldn't need to override IsDirty, because it already does the right thing.

Copyright (c) Marimer LLC