Exemplo n.º 1
0
    public virtual async Task Create(IUserService.AddCommand command, CancellationToken cancellationToken = default)
    {
        var(user, orUpdate) = command;
        var existingUser = (User?)null;
        var context      = CommandContext.GetCurrent();

        if (Computed.IsInvalidating())
        {
            _            = Get(user.Id, default).AssertCompleted();
            existingUser = context.Operation().Items.Get <User>();
            if (existingUser == null)
            {
                _ = Count(default).AssertCompleted();
Exemplo n.º 2
0
        public virtual async Task CreateAsync(IUserService.AddCommand command, CancellationToken cancellationToken = default)
        {
            var(user, orUpdate) = command;
            var existingUser = (User?)null;
            var context      = CommandContext.GetCurrent();

            if (Computed.IsInvalidating())
            {
                existingUser = context.Items.TryGet <OperationItem <User> >()?.Value;
                TryGetAsync(user.Id, default).AssertCompleted().Ignore();
                if (existingUser == null)
                {
                    CountAsync(default).AssertCompleted().Ignore();