コード例 #1
0
 public TrackedChangeRecord ToRecord(TrackedChange change)
 {
     return(new TrackedChangeRecord()
     {
         Id = change.Id,
         ActorName = change.ActorName,
         UserId = change.UserId,
         AggregateClassId = change.AggregateClassId,
         AggregateId = change.AggregateId,
         ChangeDataClassName = changeDataTypeCache.GetChangeDataTypeName(change.ChangeData.GetType()),
         ChangeDataJson = JsonConvert.SerializeObject(change.ChangeData),
         ChangeTime = change.ChangeTime,
         EntityClassId = change.EntityClassId,
         EntityId = change.EntityId
     });
 }
コード例 #2
0
        public TrackedChange AddChange <T>(T changeData, Guid?aggregateId = null, Guid?aggregateClassId = null,
                                           Guid?entityId = null, Guid?entityClassId = null, Guid?userId = null) where T : ChangeData
        {
            var           actorName = actorContext.CurrentActorName;
            var           now       = Clock.Current.Now;
            TrackedChange change    = new TrackedChange(Guid.NewGuid(), changeData, actorName: actorName,
                                                        aggregateId: aggregateId, aggregateClassId: aggregateClassId,
                                                        entityId: entityId, entityClassId: entityClassId, changeTime: now,
                                                        userId: userId);

            TrackedChangeRecord record = trackedChangeRecordConverter.ToRecord(change);

            unsavedChangeRecords.Add(record);

            return(change);
        }