public Task EventHandle(TopupEvent evt, EventMeta eventBase) { Interlocked.Increment(ref this.executedTimes); // Update database here return(Task.CompletedTask); }
public async Task TopUp(decimal amount, string flowId) { var evt = new TopupEvent { Amount = amount, Balance = this.Snapshot.Data.Balance + amount }; await this.RaiseEvent(evt, flowId); }
public Task <bool> TopUp(decimal amount) { var evt = new TopupEvent { Amount = amount, Balance = Snapshot.State.Balance + amount }; return(RaiseEvent(evt)); }
public Task <bool> TopUp(decimal amount, string topupId) { var evt = new TopupEvent { Amount = amount, Balance = this.Snapshot.Data.Balance + amount }; return(this.RaiseEvent(evt, topupId)); }
public async Task EventHandle(TopupEvent evt, EventMeta eventBase) { using (var db = this.ServiceProvider.GetService <TransferDbContext>()) { var entity = await db.Accounts.FirstOrDefaultAsync(x => x.Id == this.ActorId); this.accountSnapshotHandler.EntityHandle(entity, evt); await db.SaveChangesAsync(); } }
public Task <bool> TopUp(decimal amount) { return(ConcurrentRaiseEvent(async(snapshot, func) => { var evt = new TopupEvent { Amount = amount, Balance = Snapshot.State.Balance + amount }; await func(evt, null); })); }
public Task <bool> TopUp(decimal amount, string flowId) { return(this.ConcurrentRaiseEvent(async(snapshot, func) => { var evt = new TopupEvent { Amount = amount, Balance = this.Snapshot.Data.Balance + amount }; await func(evt); }, flowId)); }
public void EventHandle(AccountState state, TopupEvent evt) { state.Balance = evt.Balance; }
public Task EventHandle(TopupEvent evt, EventBase eventBase) { //此处更新db return(Task.CompletedTask); }
public Task EventHandle(TopupEvent evt, EventMeta eventBase) { // Update database here return(Task.CompletedTask); }
public void EntityHandle(Account entity, TopupEvent evt) { entity.Balance = evt.Balance; }
public void EventHandle(AccountSnapshot state, TopupEvent evt) { EntityHandle(state, evt); }