コード例 #1
0
        private static void OrganizationTest(EventStoreRepository repo)
        {
            var organizationId = Guid.NewGuid();

            System.Console.WriteLine("Enter organization name:");
            var orgname = Console.ReadLine();

            var orgCreatec = new OrganizationCreated {
                Name = orgname
            };

            repo.WriteEvents(new AggregateKey(typeof(Organization), organizationId), new[] { orgCreatec });

            string newName = null;

            do
            {
                var history = repo.ReadEvents(new AggregateKey(typeof(Organization), organizationId));

                var organization = new Organization(organizationId, history);
                System.Console.WriteLine("");
                System.Console.WriteLine("Organization " + organization.Name);
                System.Console.WriteLine("Rename: (q to exit)");
                newName = Console.ReadLine();

                if (!string.IsNullOrWhiteSpace(newName.Replace("q", "")))
                {
                    organization.Rename(newName);
                    organization.Save(repo);
                }
            }while (newName != "q");
        }
コード例 #2
0
        public void Apply(OrganizationCreated domainEvent)
        {
            OrganizationName    = domainEvent.OrganizationName;
            ContactPerson       = domainEvent.ContactPerson;
            ContactPhoneNumber  = domainEvent.ContactPhoneNumber;
            ContactEmailAddress = domainEvent.ContactEmailAddress;

            foreach (var clinic in domainEvent.Clinics)
            {
                Clinics.Add(new ClinicModel
                {
                    Id           = clinic.Id,
                    ClinicName   = clinic.ClinicName,
                    AddressLine1 = clinic.AddressLine1,
                    AddressLine2 = clinic.AddressLine2,
                    Suburb       = clinic.Suburb,
                    City         = clinic.City,
                    PostCode     = clinic.PostCode,
                    PhoneNumber  = clinic.PhoneNumber
                });
            }
        }
コード例 #3
0
 private void Apply(OrganizationCreated @event)
 {
     this.Name = @event.Name;
 }
コード例 #4
0
 public async Task HandleAsync(OrganizationCreated @event)
 => await CompleteForAuthenticatedUserAsync(@event);
コード例 #5
0
 public async Task HandleAsync(OrganizationCreated @event)
 => await CompleteAsync(@event);