示例#1
0
        public Task <bool> RemoveOrder()
        {
            if (!_order.State.Exists)
            {
                throw new OrderDoesNotExistsException();
            }

            _order.State = new Order(); // resets timestamp
            _order.ClearStateAsync();
            this.DeactivateOnIdle();    //Deactive the grain.
            return(Task.FromResult(true));
        }
示例#2
0
 public async Task removeData()
 {
     _note.State.finished = false;
     _note.State.noteDate = "";
     _note.State.noteText = "";
     await _note.ClearStateAsync();
 }
示例#3
0
        private Task ResetAsync()
        {
            // clear and publish the state
            _state.State.Tag   = Guid.Empty;
            _state.State.Value = null;
            _state.State.AbsoluteExpiration = null;
            _state.State.SlidingExpiration  = null;
            Publish();

            // attempt to remove stored state as well
            return(Task.WhenAll(_state.ClearStateAsync(), _flags.ClearStateAsync()));
        }
示例#4
0
        public async Task RemoveUser()
        {
            if (!_user.State.Exists)
            {
                throw new UserDoesNotExistsException();
            }

            //Remove user from database.
            await _user.ClearStateAsync();

            this.DeactivateOnIdle();
        }
示例#5
0
        public async Task <IdentityResult> Delete()
        {
            if (_data.State.Role == null)
            {
                return(IdentityResult.Failed());
            }

            await GrainFactory.RemoveFromLookup(OrleansIdentityConstants.RoleLookup, _data.State.Role.NormalizedName);

            await Task.WhenAll(_data.State.Users.Select(u => GrainFactory.GetGrain <IIdentityUserGrain <TUser, TRole> >(u).RemoveRole(_id, false)));

            await _data.ClearStateAsync();

            return(IdentityResult.Success);
        }
示例#6
0
        public async Task CheckAsync()
        {
            try
            {
                state.State = Guid.NewGuid();
                await state.WriteStateAsync();

                await state.ReadStateAsync();

                await state.ClearStateAsync();
            }
            finally
            {
                DeactivateOnIdle();
            }
        }
        public async Task <IdentityResult> Delete()
        {
            if (_data.State.User == null)
            {
                return(IdentityResult.Failed(_errorDescriber.DefaultError()));
            }

            await GrainFactory.RemoveFromLookup(OrleansIdentityConstants.EmailLookup, _data.State.User.NormalizedEmail);

            await GrainFactory.RemoveFromLookup(OrleansIdentityConstants.UsernameLookup, _data.State.User.NormalizedUserName);

            await Task.WhenAll(_data.State.Roles.Select(r => GrainFactory.GetGrain <IIdentityRoleGrain <TUser, TRole> >(r).RemoveUser(_id)));

            await _data.ClearStateAsync();

            return(IdentityResult.Success);
        }
示例#8
0
        public async Task CheckAsync()
        {
            try
            {
                State.State = new StorageHealthCheckState {
                    Id = Guid.NewGuid().ToString()
                };
                await State.WriteStateAsync();

                await State.ReadStateAsync();

                await State.ClearStateAsync();
            }
            finally
            {
                DeactivateOnIdle();
            }
        }
示例#9
0
        public async Task OnDisconnect(string?reason = null)
        {
            _logger.LogDebug("Disconnecting connection on {hubName} for connection {connectionId} from server {serverId} via {reason}",
                             _keyData.HubName, _keyData.Id, _clientState.State.ServerId, reason);

            if (_keyData.Id != null)
            {
                await _clientDisconnectStream.OnNextAsync(_keyData.Id);
            }
            await _clientState.ClearStateAsync();

            if (_serverDisconnectedSubscription != null)
            {
                await _serverDisconnectedSubscription.UnsubscribeAsync();
            }

            DeactivateOnIdle();
        }
示例#10
0
 public async Task Clear()
 {
     await _stock.ClearStateAsync();
 }
 public async Task EraseHistory()
 {
     DeactivateOnIdle();
     await _conversationState.ClearStateAsync();
 }
示例#12
0
 public Task Remove()
 {
     DeactivateOnIdle();
     return(_data.ClearStateAsync());
 }
示例#13
0
        public HelloArchiveGrain([PersistentState("archive", GrainConst.Storage)] IPersistentState <GreetingArchive> archive)
        {
            _archive = archive;

            try { _archive.ClearStateAsync().Wait(); } catch { }
        }
示例#14
0
 public async Task CleanInformationAsync()
 {
     DeactivateOnIdle();
     await _state.ClearStateAsync();
 }