聚合根的快照类定义
 public virtual void StoreShapshot(Snapshot snapshot)
 {
     using (var connection = _connectionFactory.OpenConnection())
     {
         var table = Configuration.Instance.GetSetting<string>("snapshotTable");
         connection.Insert(
             new
             {
                 UniqueId = snapshot.UniqueId,
                 Name = GetSnapshotDataName(snapshot.Data.GetType()),
                 AggregateRootId = snapshot.AggregateRootId,
                 AggregateRootName = GetAggregateRootName(snapshot.AggregateRootType),
                 Version = snapshot.Version,
                 SerializedData = SerializeSnapshotData(snapshot.Data),
                 CreatedTime = snapshot.CreatedTime
             }, table);
     }
 }
 public void StoreShapshot(Snapshot snapshot)
 {
 }
示例#3
0
 /// <summary>
 /// 从给定的快照初始化当前聚合根
 /// </summary>
 internal void InitializeFromSnapshot(Snapshot snapshot)
 {
     _uniqueId            = snapshot.AggregateRootId;
     _originalVersion     = snapshot.Version;
     _aggregateRootEvents = new Queue <AggregateRootEvent>();
 }