New Posts New Posts RSS Feed: Removing DynamicEntities from cache
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Removing DynamicEntities from cache

 Post Reply Post Reply
Author
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Topic: Removing DynamicEntities from cache
    Posted: 12-Jul-2007 at 3:45pm
 

Try this:

 

      foreach (EntityTypeInfo eti in EntityTypeInfo.GetAllDynamicTypes()) {

        if (typeof(DynamicEntity).IsAssignableFrom(eti.EntityType) && (eti.DataSourceExtension == this.mPm1.DataSourceExtension)) {

          this.mPm1.RemoveEntities(eti.EntityType, DataRowState.Unchanged);

        }

      }

 

The EntityTypeInfoGetAllDynamicTypes method is unfortunately misnamed – it will return all known entity types, and also returns everything for all known data source extensions.  (I might enter a defect report to fix this.)  Anyway, if you then filter out actual dynamic types for your data source extension, you can then do the RemoveEntities call.  Note that the dynamic entity type still exists, and its entity table is still in the PM.  Also note that removing entities with this overload, even if dynamic, causes the query cache to be cleared.  If this behavior isn’t wanted, you’d have to first retrieve the entities, and then use the RemoveEntities(list, bool) overload.

Back to Top
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Posted: 12-Jul-2007 at 3:44pm

I would like to know how I could clear from the cache all DynamicEntity instances.

We’re using PersistanceManager.RemoveEntities(type, datarowstate).

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down