/// <summary> /// Десериализует процесс /// </summary> /// <param name="br">Читатель из потока</param> protected virtual void DeserializeInternal(CustomBinaryReader br) { this.CompleteExecution = br.ReadBoolean(); this.Id = br.ReadGuid(); this.PopulateExceptions = br.ReadBoolean(); this.Stage = (BpStage)br.ReadByte(); this.StartedOnServer = br.ReadNullableBoolean(); this._status = (BpStatus)br.ReadByte(); this.TrackMode = (BpTrackMode)br.ReadByte(); this.StartTime = br.ReadDateTime(); this.FinishTime = br.ReadDateTime(); if (br.ReadBoolean()) { this._contextData = new ContextData(); this._contextData.DeserializeInternal(br); } int count = br.Read7BitEncodedInt(); List <string> paramNames = new List <string>(count); this.Parameters = new Dictionary <string, object>(count); for (int i = 0; i < count; i++) { paramNames.Add(br.ReadString()); } for (int i = 0; i < count; i++) { this.Parameters.Add(paramNames[i], br.ReadObject()); } //this.Progress = (BpProgressData)br.ReadObject(); //this.Result = (BpResultData)br.ReadObject(); if (br.ReadBoolean()) { this.Progress = this.GetProgressInstance(); ((ICustomSerializable)this.Progress).DeserializeInternal(br); } if (br.ReadBoolean()) { this.Result = this.GetResultInstance(); ((ICustomSerializable)this.Result).DeserializeInternal(br); } count = br.Read7BitEncodedInt(); this.ChildProcesses = new List <BizProcess>(count); for (int i = 0; i < count; i++) { BizProcess process = this.ReadChildProcess(br); this.AddChild(process); } BpRunningNode.Type brnType = (BpRunningNode.Type)br.ReadByte(); string brnName = br.ReadString(); this.Node = new BpRunningNode(brnType, brnName); }
/// <summary> /// Конструктор. Используется только при клонировании /// </summary> /// <param name="origin">Оригинальный экземпляр</param> /// <param name="cloneContext">Контекст клонирования</param> protected BizProcess(BizProcess origin, BpCloneContext cloneContext) { this.CompleteExecution = origin.CompleteExecution; this.StartedOnServer = origin.StartedOnServer; this.Id = (cloneContext.IsPrototype() ? Guid.NewGuid() : origin.Id); this.Stage = origin.Stage; this._status = origin._status; this.StartTime = origin.StartTime; this.FinishTime = origin.FinishTime; if (!cloneContext.IsAnyPeristence()) { this.Progress = origin.Progress; } this.ChildProcesses = new List <BizProcess>(); if (!cloneContext.IsShortPeristence()) { lock (origin.ChildProcesses) { foreach (BizProcess childProcess in origin.ChildProcesses) { this.AddChild(childProcess.Clone(cloneContext)); } } } if (!cloneContext.IsAnyPeristence() || origin.ParentProcess == null) { this._contextData = origin._contextData; } this.Parameters = new Dictionary <string, object>(); this.CloneParameters(origin, cloneContext); if (!cloneContext.IsStatus()) { this.Result = origin.Result.Clone(cloneContext); } this.PopulateExceptions = origin.PopulateExceptions; this.TrackMode = origin.TrackMode; this.Node = origin.Node; }