public static void UpdateVersion <TPrimaryKey>(this SubSnapshot <TPrimaryKey> snapshot, EventMeta eventBase, Type grainType) { if (snapshot.Version + 1 != eventBase.Version) { throw new EventVersionException(snapshot.ActorId.ToString(), grainType, eventBase.Version, snapshot.Version); } snapshot.Version = eventBase.Version; }
public static void IncrementDoingVersion <TPrimaryKey>(this SubSnapshot <TPrimaryKey> state, Type grainType) { if (state.DoingVersion != state.Version) { throw new SnapshotException(state.ActorId.ToString(), grainType, state.DoingVersion, state.Version); } state.DoingVersion++; }
public async Task Update(SubSnapshot <TPrimaryKey> snapshot) { using var db = this.dbFactory.GetSubSnapshotDb(this.optionName); await db.UpdateAsync(new SubSnapshotEntity <TPrimaryKey> { Id = snapshot.ActorId, DoingVersion = snapshot.DoingVersion, Version = snapshot.Version }, this.tableName); }
public static void UnsafeUpdateVersion <TPrimaryKey>(this SubSnapshot <TPrimaryKey> snapshot, EventMeta eventBase) { snapshot.DoingVersion = eventBase.Version; snapshot.Version = eventBase.Version; }