public virtual bool TryLoad(IAnchorDataProvider dataProvider, StoreObjectId id, Action <IAnchorStoreObject> streamAction)
        {
            AnchorUtil.ThrowOnNullArgument(dataProvider, "dataProvider");
            AnchorUtil.ThrowOnNullArgument(id, "id");
            bool success = true;

            AnchorUtil.RunTimedOperation(dataProvider.AnchorContext, delegate()
            {
                using (IAnchorStoreObject anchorStoreObject = this.FindStoreObject(dataProvider, id, this.PropertyDefinitions))
                {
                    if (anchorStoreObject.GetValueOrDefault <string>(MigrationBatchMessageSchema.MigrationPersistableDictionary, null) == null)
                    {
                        success = false;
                    }
                    else
                    {
                        anchorStoreObject.Load(this.PropertyDefinitions);
                        if (!this.ReadFromMessageItem(anchorStoreObject))
                        {
                            success = false;
                        }
                        else
                        {
                            if (streamAction != null)
                            {
                                streamAction(anchorStoreObject);
                            }
                            this.LoadLinkedStoredObjects(anchorStoreObject, dataProvider);
                        }
                    }
                }
            }, this);
            return(success);
        }
 public IAnchorStoreObject FindStoreObject(IAnchorDataProvider dataProvider, PropertyDefinition[] properties)
 {
     ExAssert.RetailAssert(this.StoreObjectId != null, "Need to persist the objects before trying to retrieve their storage object.");
     if (properties == null)
     {
         properties = this.PropertyDefinitions;
     }
     return(this.FindStoreObject(dataProvider, this.StoreObjectId, properties));
 }
 protected virtual void SaveExtendedProperties(IAnchorDataProvider provider)
 {
     AnchorUtil.AssertOrThrow(this.StoreObjectId != null, "Object should have been created before trying to save properties.", new object[0]);
     using (IAnchorStoreObject anchorStoreObject = this.FindStoreObject(provider, AnchorPersistableBase.MigrationBaseDefinitions))
     {
         anchorStoreObject.OpenAsReadWrite();
         this.WriteExtendedPropertiesToMessageItem(anchorStoreObject);
         anchorStoreObject.Save(SaveMode.FailOnAnyConflict);
     }
 }
 public virtual void CreateInStore(IAnchorDataProvider dataProvider, Action <IAnchorStoreObject> streamAction)
 {
     AnchorUtil.ThrowOnNullArgument(dataProvider, "dataProvider");
     AnchorUtil.AssertOrThrow(this.StoreObjectId == null, "Object should not have been created already.", new object[0]);
     using (IAnchorStoreObject anchorStoreObject = this.CreateStoreObject(dataProvider))
     {
         if (streamAction != null)
         {
             streamAction(anchorStoreObject);
         }
         this.WriteToMessageItem(anchorStoreObject, false);
         anchorStoreObject.Save(SaveMode.FailOnAnyConflict);
         anchorStoreObject.Load(this.PropertyDefinitions);
         this.ReadStoreObjectIdProperties(anchorStoreObject);
     }
 }
Пример #5
0
 // Token: 0x06000283 RID: 643 RVA: 0x0000944A File Offset: 0x0000764A
 protected override IAnchorStoreObject CreateStoreObject(IAnchorDataProvider dataProvider)
 {
     return(dataProvider.CreateMessage());
 }
Пример #6
0
 // Token: 0x06000280 RID: 640 RVA: 0x0000939E File Offset: 0x0000759E
 public override IAnchorStoreObject FindStoreObject(IAnchorDataProvider dataProvider, StoreObjectId id, PropertyDefinition[] properties)
 {
     return(dataProvider.FindMessage(id, properties));
 }
 public bool TryLoad(IAnchorDataProvider dataProvider, StoreObjectId id)
 {
     return(this.TryLoad(dataProvider, id, null));
 }
 protected abstract IAnchorStoreObject CreateStoreObject(IAnchorDataProvider dataProvider);
 protected virtual void LoadLinkedStoredObjects(IAnchorStoreObject item, IAnchorDataProvider dataProvider)
 {
 }
 public IAnchorStoreObject FindStoreObject(IAnchorDataProvider dataProvider)
 {
     return(this.FindStoreObject(dataProvider, null));
 }
 public abstract IAnchorStoreObject FindStoreObject(IAnchorDataProvider dataProvider, StoreObjectId id, PropertyDefinition[] properties);
Пример #12
0
 public BandSettingsStorage(IAnchorDataProvider anchorDataProvider, LoadBalanceAnchorContext anchorContext)
 {
     this.anchorDataProvider       = anchorDataProvider;
     this.logger                   = anchorContext.Logger;
     this.loadBalanceAnchorContext = anchorContext;
 }