Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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++;
        }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 public static void UnsafeUpdateVersion <TPrimaryKey>(this SubSnapshot <TPrimaryKey> snapshot, EventMeta eventBase)
 {
     snapshot.DoingVersion = eventBase.Version;
     snapshot.Version      = eventBase.Version;
 }