Print Page | Close Window

ListManager delegate not detecting deletes

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1091
Printed Date: 28-Jul-2025 at 9:14pm


Topic: ListManager delegate not detecting deletes
Posted By: mrivers
Subject: ListManager delegate not detecting deletes
Date Posted: 11-Feb-2009 at 12:54pm
I've created a ListManager who's delegate always returns true when an entity being managed by the ListManager changes or is added. I would also like the delegate to catch any deletions of the managed entity type. Do I have to do something different to be able to detect the deletions?
 
Here is my code snippet:
........................................................
mEntityList = pManager.PersistenceManager.GetEntities<Property_Entity>(pQuery);
Predicate<Property_Entity> predicate =
delegate(Property_Entity pType)
{
return true;
};
 
mEntityList.ListManager = new EntityListManager<Property_Entity>(pManager.PersistenceManager,
predicate,
new EntityColumn[] { Property_Entity.PropertyidEntityColumn, Property_Entity.PresentvalueEntityColumn, Property_Entity.LiquidEntityColumn });
.............................................



Replies:
Posted By: GregD
Date Posted: 16-Feb-2009 at 3:26pm
Originally posted by mrivers

I've created a ListManager who's delegate always returns true when an entity being managed by the ListManager changes or is added. I would also like the delegate to catch any deletions of the managed entity type. Do I have to do something different to be able to detect the deletions?
 
Here is my code snippet:
........................................................
mEntityList = pManager.PersistenceManager.GetEntities<Property_Entity>(pQuery);
Predicate<Property_Entity> predicate =
delegate(Property_Entity pType)
{
return true;
};
 
mEntityList.ListManager = new EntityListManager<Property_Entity>(pManager.PersistenceManager,
predicate,
new EntityColumn[] { Property_Entity.PropertyidEntityColumn, Property_Entity.PresentvalueEntityColumn, Property_Entity.LiquidEntityColumn });
.............................................



Originally posted by mrivers


Do I have to do something different to be able to detect the deletions?


1. DevForce removes deleted entities from EntityLists as a matter of course: no EntityListManager required.  What contrary behavior are you seeing?

2. EntityListManagers can be expensive, performance-wise, if overused and/or defined inefficiently. The EntityListManager you've defined looks somewhat inefficient in that, since you've said *any* entity of the specified type belongs in the list (no exclusionary criteria in the predicate), I don't see what the point is of monitoring the Presentvalue and Liquid entity columns. The test on the PropertyidEntityColumn will already guarantee that any new instance of Property_Entity will get included in your list; and there's no change to either a Presentvalue or Liquid property that would cause an entity already in the list to be removed from it.




Print Page | Close Window