//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);
     }
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public RoleDTO(ApplicationMsgs.RoleCreated @event)
 {
     Id       = @event.RoleId;
     PolicyId = @event.PolicyId;
     Name     = @event.Name;
 }