Maybe add ApplyAllEdits()?

Maybe add ApplyAllEdits()?

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


CaymanIslandsCarpediem posted on Thursday, March 15, 2007

It seems I'm fairly often hitting cases where I call BeginEdit on an item then after editing it I call ApplyEdit and try to save.  Sometimes I'm getting "cannot save because item is still being edited" error because databinding had automatically called BeginEdit on that item all ready.

I'd like to know thoughts on adding another method to CSLA like ApplyAllEdits.  It would basically just loop through calling ApplyEdit until the edit level is to zero.  Does this sound like it would be useful to anyone else?  Or should I just pay more attention and figure out where data binding will be calling BeginEdit for me? ;-)

Thanks for any thoughts!

RockfordLhotka replied on Thursday, March 15, 2007

You really need to call bindingSource.EndEdit() or CancelEdit(), otherwise data binding itself can get confused.

So even if there was an ApplyAllEdits() you could call on a root object, your end result wouldn't be reliable because data binding wouldn't know what you did.

In short, you just need to pay more attention I'm afraid... :)

Copyright (c) Marimer LLC