/// <summary> /// 从给定的快照数据对象萃取得到快照对象。 /// </summary> /// <param name="acDomain"></param> /// <param name="dataObject">快照数据对象</param> /// <returns>快照对象</returns> public static ISnapshot ExtractSnapshot(this IAcDomain acDomain, SnapshotDataObject dataObject) { var serializer = acDomain.RetrieveRequiredService<ISnapshotSerializer>(); var snapshotType = Type.GetType(dataObject.SnapshotType); if (snapshotType == null) return null; return (ISnapshot)serializer.Deserialize(snapshotType, dataObject.SnapshotData); }
/// <summary> /// 从给定的快照数据对象萃取得到快照对象。 /// </summary> /// <param name="acDomain"></param> /// <param name="dataObject">快照数据对象</param> /// <returns>快照对象</returns> public static ISnapshot ExtractSnapshot(this IAcDomain acDomain, SnapshotDataObject dataObject) { var serializer = acDomain.RetrieveRequiredService <ISnapshotSerializer>(); var snapshotType = Type.GetType(dataObject.SnapshotType); if (snapshotType == null) { return(null); } return((ISnapshot)serializer.Deserialize(snapshotType, dataObject.SnapshotData)); }
/// <summary> /// 从给定的快照数据对象萃取得到快照对象。 /// </summary> /// <param name="serializer"></param> /// <param name="dataObject">快照数据对象</param> /// <returns>快照对象</returns> public static ISnapshot <TAggregateRootId> ExtractSnapshot <TAggregateRootId>(this ISnapshotSerializer serializer, SnapshotDataObject <TAggregateRootId> dataObject) { var snapshotType = Type.GetType(dataObject.SnapshotType); if (snapshotType == null) { return(null); } return((ISnapshot <TAggregateRootId>)serializer.Deserialize(snapshotType, dataObject.SnapshotData)); }