예제 #1
0
        public virtual void ProcessCommand(IEntityGuid entity, CommandTypeOption type)
        {
            if (entity == null)
            {
                return;
            }

            var storeHistoryAttributes = entity.GetType().GetCustomAttributes(typeof(StoreHistoryAttribute), inherit: true);

            if (!storeHistoryAttributes.HasItems <object>())
            {
                return;
            }

            var    storeHistoryAttr = (StoreHistoryAttribute)storeHistoryAttributes.First();
            string serializedData   = null;

            if (storeHistoryAttr.StoreSnapShot)
            {
                serializedData = _serializer.Serialize(entity);
            }

            var entityHistory = CreateHistoryRecord(storeHistoryAttr, entity, type, _currentUser, serializedData);

            ProcessCustomValuesForEntity(entity, entityHistory);

            _repository.AddOrUpdate(entityHistory);
        }
예제 #2
0
 public void ProcessCommand(IEntityGuid entity, CommandTypeOption type)
 {
     return;
 }
예제 #3
0
 protected virtual IEntityHistory CreateHistoryRecord(StoreHistoryAttribute attribute, IEntityGuid entity, CommandTypeOption type, IUserId user, string data)
 {
     return(new EntityHistory(attribute.EntityTypeId, type, entity.Guid, user.Id, data));
 }