public void Invalidate(ObjectId[] objectsToInvalidate) { foreach (var roleByAssociationEntry in this.cachedCompositeRoleByAssociationByRoleType) { var roleByAssociation = roleByAssociationEntry.Value; foreach (var objectToInvalidate in objectsToInvalidate) { roleByAssociation.Remove(objectToInvalidate); } } foreach (var roleByAssociationEntry in this.cachedCompositeRoleByAssociationByRoleType) { var roleByAssociation = roleByAssociationEntry.Value; foreach (var objectToInvalidate in objectsToInvalidate) { roleByAssociation.Remove(objectToInvalidate); } } foreach (var roleByAssociationEntry in this.cachedCompositesRoleByAssociationByRoleType) { var roleByAssociation = roleByAssociationEntry.Value; foreach (var objectToInvalidate in objectsToInvalidate) { roleByAssociation.Remove(objectToInvalidate); } } }
internal Reference(Session session, IClass @class, ObjectId objectId, long cacheId) : this(session, @class, objectId, false) { this.cacheId = cacheId; this.flags[MaskExistsKnown] = true; this.flags[MaskExists] = true; }
internal override void AdjustCurrentId(ObjectId id) { var idLong = (ObjectIdLong)id; if (idLong.ValueLong > this.currentId) { this.currentId = idLong.ValueLong; } }
internal override void AdjustCurrentId(ObjectId id) { ObjectIdInteger idInteger = (ObjectIdInteger) id; if (idInteger.ValueInteger > currentId) { currentId = idInteger.ValueInteger; } }
internal Reference(Session session, IClass @class, ObjectId objectId, bool isNew) { this.session = session; this.@class = @class; this.objectId = objectId; this.flags[MaskIsNew] = isNew; if (isNew) { this.flags[MaskExistsKnown] = true; this.flags[MaskExists] = true; } }
public ICachedObject GetOrCreateCachedObject(IClass concreteClass, ObjectId objectId, long localCacheId) { if (this.transientConcreteClasses != null && this.transientConcreteClasses.Contains(concreteClass)) { return new CachedObject(localCacheId); } CachedObject cachedObject; if (this.cachedObjectByObjectId.TryGetValue(objectId, out cachedObject)) { if (!cachedObject.LocalCacheVersion.Equals(localCacheId)) { cachedObject = new CachedObject(localCacheId); this.cachedObjectByObjectId[objectId] = cachedObject; } } else { cachedObject = new CachedObject(localCacheId); this.cachedObjectByObjectId[objectId] = cachedObject; } return cachedObject; }
internal void OnCreated(ObjectId objectId) { this.created.Add(objectId); }
public void SetObjectType(ObjectId objectId, IClass objectType) { this.objectTypeByObjectId[objectId] = objectType; }
public IClass GetObjectType(ObjectId objectId) { IClass objectType; this.objectTypeByObjectId.TryGetValue(objectId, out objectType); return objectType; }
public void OnChangingCompositesRole(ObjectId association, IRoleType roleType, ObjectId changedRole) { this.associations.Add(association); if (changedRole != null) { this.roles.Add(changedRole); } this.RoleTypes(association).Add(roleType); }
public bool IsForced(ObjectId objectId) { return this.ForcedDerivations.Contains(objectId); }
internal bool Contains(ObjectId objectId) { if (this.removed != null && this.removed.Contains(objectId)) { return false; } return this.baseline.Contains(objectId) || (this.added != null && this.added.Contains(objectId)); }
internal UnitRelation(ObjectId association, object role) { this.Association = association; this.Role = role; }
public void OnChangingUnitRole(ObjectId association, IRoleType roleType) { this.associations.Add(association); this.RoleTypes(association).Add(roleType); }
internal bool ExtentContains(IRoleType roleType, ObjectId objectId) { CompositesRole compositesRole; if (this.ModifiedRolesByRoleType != null && this.ModifiedRolesByRoleType.TryGetValue(roleType, out compositesRole)) { return compositesRole.Contains(objectId); } return Array.IndexOf(this.GetNonModifiedCompositeRoles(roleType), objectId) >= 0; }
public bool TryGetUnit(ObjectId association, object cacheId, IRoleType roleType, out object role) { Dictionary<ObjectId, CachedUnitRole> entryByAssociation; if (this.cachedUnitRoleByAssociationByRoleType.TryGetValue(roleType, out entryByAssociation)) { CachedUnitRole cachedUnitRole; if (entryByAssociation.TryGetValue(association, out cachedUnitRole)) { if (cachedUnitRole.CacheId.Equals(cacheId)) { role = cachedUnitRole.Role; return true; } } } role = null; return false; }
internal void OnChangingCompositeRole(Roles association, IRoleType roleType, ObjectId previousRole, ObjectId newRole) { this.associations.Add(association.Reference.ObjectId); if (previousRole != null) { this.roles.Add(previousRole); } if (newRole != null) { this.roles.Add(newRole); } this.RoleTypes(association.Reference.ObjectId).Add(roleType); }
public ISet<IRoleType> GetRoleTypes(ObjectId association) { ISet<IRoleType> roleTypes; if (this.RoleTypesByAssociation.TryGetValue(association, out roleTypes)) { return roleTypes; } return this.emptySet; }
public void OnDeleted(ObjectId objectId) { this.deleted.Add(objectId); }
public void OnCreated(ObjectId objectId) { this.created.Add(objectId); }
internal CachedCompositesRole(object cacheId, ObjectId[] role) { this.cacheId = cacheId; this.role = role; }
internal void OnDeleted(ObjectId objectId) { this.deleted.Add(objectId); }
public void SetComposite(ObjectId association, object cacheId, IRoleType roleType, ObjectId role) { Dictionary<ObjectId, CachedCompositeRole> entryByAssociation; if (!this.cachedCompositeRoleByAssociationByRoleType.TryGetValue(roleType, out entryByAssociation)) { entryByAssociation = new Dictionary<ObjectId, CachedCompositeRole>(); this.cachedCompositeRoleByAssociationByRoleType[roleType] = entryByAssociation; } entryByAssociation[association] = new CachedCompositeRole(cacheId, role); }
private ISet<IRoleType> RoleTypes(ObjectId associationId) { ISet<IRoleType> roleTypes; if (!this.RoleTypesByAssociation.TryGetValue(associationId, out roleTypes)) { roleTypes = new HashSet<IRoleType>(); this.RoleTypesByAssociation[associationId] = roleTypes; } return roleTypes; }
internal bool TryGetCompositeRole(IRoleType roleType, out ObjectId roleId) { roleId = null; object role = null; if (this.modifiedRoleByRoleType == null || !this.modifiedRoleByRoleType.TryGetValue(roleType, out role)) { if (this.CachedObject == null || !this.CachedObject.TryGetValue(roleType, out role)) { if (!this.Reference.IsNew) { return false; } } } roleId = (ObjectId)role; return true; }
public static C1 Instantiate(ISession session, ObjectId id) { return (C1)session.Instantiate(id); }
internal void Remove(ObjectId objectId) { if (this.original == null) { this.original = new HashSet<ObjectId>(this.baseline); } if (this.added != null && this.added.Contains(objectId)) { this.added.Remove(objectId); return; } if (this.baseline.Contains(objectId)) { if (this.removed == null) { this.removed = new HashSet<ObjectId>(); } this.removed.Add(objectId); } }
private IObject GetObject(ObjectId objectId) { return new Strategy(this.Session, objectId).GetObject(); }
internal Strategy(Session session, ObjectId objectId) { this.session = session; this.objectId = objectId; }
internal abstract void AdjustCurrentId(ObjectId id);