private void Apply(RegistrationCreated @event) { Id = @event.AggregateRootId; Person = @event.Person; RegistrationTarget = @event.RegistrationTarget; RegistrationDate = @event.RegistrationDate; }
public void When(RegistrationCreated e) { Id = e.Id; Customer = e.Customer.CustomerId; Security = e.Security.SecurityId; CustomerInfo = e.Customer; SecurityInfo = e.Security; }
public void When(RegistrationCreated e) { _entity.Add(e.Id, new RegistrationView { Status = "Processing registration", Registration = e.Id, }); }
public void When(RegistrationCreated e) { _entity.Add(e.Id, new RegistrationView { Status = "Processing registration", Registration = e.Id }); }
public async Task <Either <Error, RegistrationCreated> > Create(CreateRegistration command) { if (State.Created) { return(Left <Error, RegistrationCreated>(Error.New("Registration already exists"))); } var e = new RegistrationCreated { Email = command.Email, FirstName = command.FirstName }; RaiseEvent(e); await SendWelcomeEmail(command); return(Right <Error, RegistrationCreated>(e)); }
public UUID Register(string appName, string host) { if (string.IsNullOrWhiteSpace(appName)) { throw new RpcException(new Grpc.Core.Status(StatusCode.InvalidArgument, $"Application name { appName } cannot be null or empty")); } if (string.IsNullOrWhiteSpace(host)) { throw new RpcException(new Grpc.Core.Status(StatusCode.InvalidArgument, $"Host { host } cannot be null or empty")); } if (!Uri.TryCreate(host, UriKind.Absolute, out var _)) { throw new RpcException(new Grpc.Core.Status(StatusCode.InvalidArgument, $"Host { host } is not a valid host")); } var existingRegistration = _registrations.Values.FirstOrDefault(x => x.AppName.Equals(appName, StringComparison.OrdinalIgnoreCase) && x.Host.Equals(host, StringComparison.OrdinalIgnoreCase)); if (existingRegistration != null) { return(existingRegistration.UniqueIdentifier); //throw new RpcException(new Grpc.Core.Status(StatusCode.AlreadyExists, $"Application name { appName } with host { host } already registered")); } var uniqueIdGuid = Guid.NewGuid(); var uniqueId = new UUID() { Value = uniqueIdGuid.ToString() }; _registrations.AddOrUpdate(uniqueIdGuid, (key) => new Registration(uniqueId, appName, host), (key, value) => new Registration(uniqueId, appName, host)); var registration = new RegistrationCreatedEventArgs() { Registration = _registrations[uniqueIdGuid] }; RegistrationCreated?.Invoke(this, registration); _logger.LogInformation($"Registered application with appName {appName} and host {host}"); return(uniqueId); }
public void When(RegistrationCreated x) { // forwards token to customer var c = x.Customer; var s = x.Security; //_flow.ToCustomer(new CreateCustomerFromRegistration( // c.CustomerId, // x.Id, // c.CompanyName, // c.CustomerEmail, // c.OptionalPhone, // c.OptionalUrl, // x.RegisteredUtc, c.CurrencyType, c.RealName)); // and to security passport _flow.ToSecurity(new CreateSecurityFromRegistration(s.SecurityId, x.Id, s.Login, s.Pwd, s.UserDisplay, s.OptionalIdentity)); // TODO add timeout tracker }
public void Apply(RegistrationCreated _) => Created = true;