Пример #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);
        }
Пример #2
0
        async Task When(OrganizationRegistered e, long checkpoint)
        {
            var doc = await Store.LoadAsync <Organization>(e.Id);

            if (doc == null)
            {
                doc = new Organization();
            }
            doc.Id      = e.Id;
            doc.Name    = e.Name;
            doc.Address = e.Address;
            await Store.StoreAsync(doc);
        }
 void When(OrganizationRegistered e)
 {
     Id      = e.Id;
     Name    = e.Name;
     Address = e.Address;
 }