Пример #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 EntityHistory(int entityTypeId, CommandTypeOption commandType, Guid entityGuid, int userId, string data)
        {
            TypeId        = entityTypeId;
            CommandTypeId = (int)commandType;
            EntityGuid    = entityGuid;
            Event         = new CommandDate(userId);

            if (!string.IsNullOrWhiteSpace(data))
            {
                Data = new EntityHistoryData(this, data);
            }
        }
Пример #3
0
 public void Add(CommandTypeOption type, string data)
 {
     var cmd = new CommandInfo(type, data);
     this.Add(cmd);
 }
Пример #4
0
 public EntityHistory(int entityTypeId, CommandTypeOption commandType, Guid entityGuid, int userId)
     : this(entityTypeId, commandType, entityGuid, userId, null)
 {
 }
Пример #5
0
 public void ProcessCommand(IEntityGuid entity, CommandTypeOption type)
 {
     return;
 }
Пример #6
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));
 }
Пример #7
0
 public CommandInfo(CommandTypeOption type, string data)
 {
     this.CommandType = type;
     this.Data = data;
 }
Пример #8
0
		public CommandInfo(CommandTypeOption type, string data)
		{
			CommandType = type;
			Data = data;
		}