//Apply State only if it applies to my id private void Apply(ApplicationMsgs.RoleCreated @event) { if (@event.PolicyId == Id) { _rolesById.Add(@event.RoleId, @event.Name); _rolesByName.Add(@event.Name, @event.RoleId); } }
public void Handle(ApplicationMsgs.RoleCreated @event) { var policy = _policies.Lookup(@event.PolicyId); if (policy.HasValue && !_roles.ContainsKey(@event.RoleId)) { var role = new RoleDTO(@event); _roles.Add(@event.RoleId, role); policy.Value.Roles.AddOrUpdate(role); } }
public RoleDTO(ApplicationMsgs.RoleCreated @event) { Id = @event.RoleId; PolicyId = @event.PolicyId; Name = @event.Name; }