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));
public async Task <object> Any(RegisterOrganization request) => await TryProcessRequest <PL.Commands.RegisterOrganization>(request);
bool IsIdempotent(RegisterOrganization c) => c.Id == State.Id && c.Name == State.Name && c.Address == State.Address;