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); }
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(); } }
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(); } }