コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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));
        }
コード例 #3
0
        /// <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));
        }