Exemple #1
0
        public void UpdatePermission(string roleId, ICollection <KeyValuePair <string, string> > claims)
        {
            var evt = new CaseInstanceRoleUpdatedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, roleId, claims, DateTime.UtcNow);

            Handle(evt);
            DomainEvents.Add(evt);
        }
Exemple #2
0
        private void Handle(CaseInstanceRoleUpdatedEvent evt)
        {
            var role = Roles.FirstOrDefault(_ => _.EltId == evt.RoleId);

            if (role == null)
            {
                throw new AggregateValidationException(new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("validation", $"unknown role '{evt.RoleId}'")
                });
            }

            UpdateDateTime = evt.UpdateDateTime;
            Version        = evt.Version;
        }