Beispiel #1
0
        private static TierMigrationProcessingState GetCurrentState(Model.WorkQueue item)
        {
            if (item.Data == null)
            {
                //TODO: What about old entries?
                return(TierMigrationProcessingState.NotStated);
            }
            TierMigrationWorkQueueData data = XmlUtils.Deserialize <TierMigrationWorkQueueData>(item.Data);

            return(data.State);
        }
Beispiel #2
0
        private static void UpdateState(ServerEntityKey key, TierMigrationProcessingState state)
        {
            TierMigrationWorkQueueData data = new TierMigrationWorkQueueData {
                State = state
            };

            using (IUpdateContext context = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush))
            {
                IWorkQueueEntityBroker broker = context.GetBroker <IWorkQueueEntityBroker>();
                WorkQueueUpdateColumns parms  = new WorkQueueUpdateColumns {
                    Data = XmlUtils.SerializeAsXmlDoc(data)
                };
                if (!broker.Update(key, parms))
                {
                    throw new ApplicationException("Unable to update work queue state");
                }
                context.Commit();
            }
        }