static protected byte[] GetDefaultSerializedForm(Activity activity) { DateTime startTime = DateTime.Now; Byte[] result; Debug.Assert(activity != null, "Null activity"); using (MemoryStream stream = new MemoryStream(10240)) { stream.Position = 0; activity.Save(stream); using (MemoryStream compressedStream = new MemoryStream((int)stream.Length)) { using (GZipStream gzs = new GZipStream(compressedStream, CompressionMode.Compress, true)) { gzs.Write(stream.GetBuffer(), 0, (int)stream.Length); } ActivityExecutionContextInfo executionContextInfo = (ActivityExecutionContextInfo)activity.GetValue(Activity.ActivityExecutionContextInfoProperty); TimeSpan timeElapsed = DateTime.Now - startTime; WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "Serialized a {0} with id {1} to length {2}. Took {3}.", executionContextInfo, executionContextInfo.ContextGuid, compressedStream.Length, timeElapsed); result = compressedStream.GetBuffer(); Array.Resize <Byte>(ref result, Convert.ToInt32(compressedStream.Length)); } } return(result); }
internal static Activity ParentContextActivity(Activity activity) { ActivityExecutionContextInfo info = (ActivityExecutionContextInfo)ContextActivity(activity).GetValue(Activity.ActivityExecutionContextInfoProperty); if (info.ParentContextId == -1) { return(null); } return(RetrieveWorkflowExecutor(activity).GetContextActivityForId(info.ParentContextId)); }
protected static byte[] GetDefaultSerializedForm(Activity activity) { byte[] buffer; DateTime now = DateTime.Now; using (MemoryStream stream = new MemoryStream(0x2800)) { stream.Position = 0L; activity.Save(stream); using (MemoryStream stream2 = new MemoryStream((int)stream.Length)) { using (GZipStream stream3 = new GZipStream(stream2, CompressionMode.Compress, true)) { stream3.Write(stream.GetBuffer(), 0, (int)stream.Length); } ActivityExecutionContextInfo info = (ActivityExecutionContextInfo)activity.GetValue(Activity.ActivityExecutionContextInfoProperty); TimeSpan span = (TimeSpan)(DateTime.Now - now); WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "Serialized a {0} with id {1} to length {2}. Took {3}.", new object[] { info, info.ContextGuid, stream2.Length, span }); buffer = stream2.GetBuffer(); Array.Resize <byte>(ref buffer, Convert.ToInt32(stream2.Length)); } } return(buffer); }
public System.Workflow.ComponentModel.Activity LoadContextActivity(ActivityExecutionContextInfo contextInfo, System.Workflow.ComponentModel.Activity outerContextActivity) { throw new NotImplementedException(string.Format(CultureInfo.CurrentCulture, ExecutionStringManager.InteropNonSupportedBehavior, new object[] { this.ServiceProvider.Activity.DisplayName })); }
public Activity LoadContextActivity(ActivityExecutionContextInfo contextInfo, Activity outerContextActivity) { throw new NotImplementedException(string.Format(CultureInfo.CurrentCulture, ExecutionStringManager.InteropNonSupportedBehavior, this.ServiceProvider.Activity.DisplayName)); }