DynamicListBase RemoveItem

DynamicListBase RemoveItem

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


dmnc posted on Wednesday, August 18, 2010

Hi,

Removing a pre-exisiting item from a DynamicListBase results in deleting and saving the item. However, the item is only removed from the collection if it is new? I'm just using it in code without binding to a grid.

Thank you!

RockfordLhotka replied on Wednesday, August 18, 2010

The behavior you describe is correct. If IsNew=false then there's something to delete, so it is deleted. If IsNew=true then there's nothing to delete so the item is just removed from the collection.

The definition of IsNew is very simple: If true, to the best of our knowledge there's data in the data store corresponding to the object. If false, to the best of our knowledge there is no data in the data store corresponding to the object.

All editable CSLA objects are designed around that definition of IsNew.

Jav replied on Wednesday, August 18, 2010

RockfordLhotka
If true, to the best of our knowledge there's data in the data store corresponding to the object. If false, to the best of our knowledge there is no data in the data store corresponding to the object.

Rocky,
Shouldn't it be the other way round.  IsNew when there is no data in DB corresponding to the object.

Welcome back.  We were wondering where you were.  We knew it wasn't a vacation, because you just can't resist peeking in here even when you are on vacation.  Someone said, "Argentina may be!".  I said, "No, No, No Way, Not Rocky!" Big Smile   The forum was beginning to look like every other forum that is out there - abundance of questions, paucity of answers.

RockfordLhotka replied on Wednesday, August 18, 2010

Yeah, I got it backward and forward all in the same post.

I am on vacation - in far north Minnesota where I only sporadically get cell service at all, much less data service. About 1-2 times a day I've been driving to the top of a hill or even into a nearby town to get enough cell service to get online.

But the fishing is excellent, and that's what really matters! :)

dmnc replied on Thursday, August 19, 2010

I figured out that the save/update in DynamicListBase is now asynchronous. That's the reason why the following didn't work for me anymore:

var products = Products.GetProducts();
products.Remove(products.First());
products.Remove(products.First());

Enjoy your remaining vacation days!

Copyright (c) Marimer LLC