Exemplo n.º 1
0
 public PropertyExistenceTracker(NativeStorePropertyDefinition trackedProperty) : base(trackedProperty.Name + "_Tracker", trackedProperty.Type, PropertyFlags.None, new PropertyDefinitionConstraint[0], new PropertyDependency[]
 {
     new PropertyDependency(InternalSchema.PropertyExistenceTracker, PropertyDependencyType.NeedForRead)
 })
 {
     this.bitFlag = PropertyExistenceTracker.GetBitFlag(trackedProperty);
     if (this.bitFlag == -1L)
     {
         throw new ArgumentException(string.Format("{0} not in Tracked property list", trackedProperty));
     }
 }
Exemplo n.º 2
0
        private void TrackProperty(StorePropertyDefinition propertyDefinition, bool isAdded)
        {
            if (!this.trackingPropertyExistence)
            {
                return;
            }
            long bitFlag = PropertyExistenceTracker.GetBitFlag(propertyDefinition);

            if (bitFlag == -1L)
            {
                return;
            }
            if (this.propertyExistenceBitMap == null)
            {
                object obj = base.TryGetProperty(InternalSchema.PropertyExistenceTracker);
                if (obj is long)
                {
                    this.propertyExistenceBitMap = new long?((long)obj);
                }
                else
                {
                    this.propertyExistenceBitMap = new long?(0L);
                }
            }
            if (isAdded)
            {
                this.propertyExistenceBitMap = new long?(this.propertyExistenceBitMap.Value | bitFlag);
            }
            else
            {
                this.propertyExistenceBitMap &= ~bitFlag;
            }
            if (this.propertyExistenceBitMap.Value != 0L)
            {
                ((IDirectPropertyBag)this.memoryPropertyBag).SetValue(InternalSchema.PropertyExistenceTracker, this.propertyExistenceBitMap.Value);
                return;
            }
            ((IDirectPropertyBag)this.memoryPropertyBag).Delete(InternalSchema.PropertyExistenceTracker);
        }