Example #1
0
        internal void RegisterOrganization(RegisterOrganization c)
        {
            if (State.Version > 0)
            {
                if (IsIdempotent(c))
                {
                    return;
                }
                else
                {
                    throw DomainError.Named("OrganizationAlreadyExists", string.Empty);
                }
            }

            var e = new OrganizationRegistered()
            {
                Id         = c.Id,
                IssuedBy   = c.IssuedBy,
                TimeIssued = c.TimeIssued,
                Name       = c.Name,
                Address    = c.Address
            };

            Apply(e);
        }
 async Task When(RegisterOrganization c)
 => await IdempotentlyCreateAgg(c.Id, agg => agg.RegisterOrganization(c));
Example #3
0
 public async Task <object> Any(RegisterOrganization request)
 => await TryProcessRequest <PL.Commands.RegisterOrganization>(request);
Example #4
0
 bool IsIdempotent(RegisterOrganization c)
 => c.Id == State.Id &&
 c.Name == State.Name &&
 c.Address == State.Address;