public async Task On(Envelope <IEvent> @event) { if (@event.Payload is AppEvent appEvent) { var appGrain = await factory.GetAsync <AppStateGrain, AppStateGrainState>(appEvent.AppId.Name); await appGrain.HandleAsync(@event); } if (@event.Payload is AppContributorAssigned contributorAssigned) { var userGrain = await factory.GetAsync <AppUserGrain, AppUserGrainState>(contributorAssigned.ContributorId); await userGrain.AddAppAsync(contributorAssigned.AppId.Name); } if (@event.Payload is AppContributorRemoved contributorRemoved) { var userGrain = await factory.GetAsync <AppUserGrain, AppUserGrainState>(contributorRemoved.ContributorId); await userGrain.RemoveAppAsync(contributorRemoved.AppId.Name); } }
public async Task <IAppEntity> GetAppAsync(string appName) { var app = await factory.GetAsync <AppStateGrain, AppStateGrainState>(appName); return(await app.GetAppAsync()); }