1 // **************************************************************************** 2 // Copyright (C) 2000-2001 Microsoft Corporation. All rights reserved. 3 // 4 // CONTENTS 5 // Activity interface 6 // 7 // DESCRIPTION 8 // 9 // REVISIONS 10 // Date Ver By Remarks 11 // ~~~~~~~~~~ ~~~ ~~~~~~~~ ~~~~~~~~~~~~~~ 12 // 03/19/04 1.0 MayankM interfaces 13 // **************************************************************************** 14 namespace System.Workflow.ComponentModel 15 { 16 using System; 17 using System.IO; 18 using System.Text; 19 using System.ComponentModel; 20 using System.ComponentModel.Design; 21 using System.CodeDom; 22 using System.ComponentModel.Design.Serialization; 23 using System.Collections; 24 using System.Collections.Generic; 25 using System.Collections.Specialized; 26 using System.Reflection; 27 using System.Security.Principal; 28 using System.Security.Cryptography; 29 using Microsoft.CSharp; 30 using System.Workflow.ComponentModel.Compiler; 31 using System.Workflow.ComponentModel.Design; 32 using System.Workflow.ComponentModel.Serialization; 33 using System.Collections.ObjectModel; 34 using System.Runtime.Serialization; 35 using System.Threading; 36 37 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 38 public interface IDynamicPropertyTypeProvider 39 { GetPropertyType(IServiceProvider serviceProvider, string propertyName)40 Type GetPropertyType(IServiceProvider serviceProvider, string propertyName); GetAccessType(IServiceProvider serviceProvider, string propertyName)41 AccessTypes GetAccessType(IServiceProvider serviceProvider, string propertyName); 42 } 43 44 internal interface ISupportWorkflowChanges 45 { OnActivityAdded(ActivityExecutionContext rootContext, Activity addedActivity)46 void OnActivityAdded(ActivityExecutionContext rootContext, Activity addedActivity); OnActivityRemoved(ActivityExecutionContext rootContext, Activity removedActivity)47 void OnActivityRemoved(ActivityExecutionContext rootContext, Activity removedActivity); OnWorkflowChangesCompleted(ActivityExecutionContext rootContext)48 void OnWorkflowChangesCompleted(ActivityExecutionContext rootContext); 49 } 50 internal interface ISupportAlternateFlow 51 { 52 IList<Activity> AlternateFlowActivities { get; } 53 } 54 55 [AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] 56 internal sealed class ActivityExecutorAttribute : Attribute 57 { 58 private string executorTypeName = string.Empty; 59 ActivityExecutorAttribute(Type executorType)60 public ActivityExecutorAttribute(Type executorType) 61 { 62 if (executorType != null) 63 this.executorTypeName = executorType.AssemblyQualifiedName; 64 } 65 ActivityExecutorAttribute(string executorTypeName)66 public ActivityExecutorAttribute(string executorTypeName) 67 { 68 this.executorTypeName = executorTypeName; 69 } 70 71 public string ExecutorTypeName 72 { 73 get 74 { 75 return this.executorTypeName; 76 } 77 } 78 } 79 80 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 81 public enum ActivityExecutionStatus : byte 82 { 83 Initialized = 0, 84 Executing = 1, 85 Canceling = 2, 86 Closed = 3, 87 Compensating = 4, 88 Faulting = 5 89 } 90 91 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 92 public enum ActivityExecutionResult : byte 93 { 94 None = 0, 95 Succeeded = 1, 96 Canceled = 2, 97 Compensated = 3, 98 Faulted = 4, 99 Uninitialized = 5 100 } 101 102 internal interface IDependencyObjectAccessor 103 { 104 //This method is invoked during the definition creation time InitializeDefinitionForRuntime(DependencyObject parentDependencyObject)105 void InitializeDefinitionForRuntime(DependencyObject parentDependencyObject); 106 107 //This is invoked for every instance (not necessarily activating) InitializeInstanceForRuntime(IWorkflowCoreRuntime workflowCoreRuntime)108 void InitializeInstanceForRuntime(IWorkflowCoreRuntime workflowCoreRuntime); 109 110 //This is invoked for every activating instance InitializeActivatingInstanceForRuntime(DependencyObject parentDependencyObject, IWorkflowCoreRuntime workflowCoreRuntime)111 void InitializeActivatingInstanceForRuntime(DependencyObject parentDependencyObject, IWorkflowCoreRuntime workflowCoreRuntime); 112 GetInvocationList(DependencyProperty dependencyEvent)113 T[] GetInvocationList<T>(DependencyProperty dependencyEvent); 114 } 115 116 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 117 public interface IStartWorkflow 118 { StartWorkflow(Type workflowType, Dictionary<string, object> namedArgumentValues)119 Guid StartWorkflow(Type workflowType, Dictionary<string, object> namedArgumentValues); 120 } 121 122 internal interface IWorkflowCoreRuntime : IServiceProvider 123 { 124 // context information 125 Activity RootActivity { get; } 126 Activity CurrentActivity { get; } 127 Activity CurrentAtomicActivity { get; } SetCurrentActivity(Activity activity)128 IDisposable SetCurrentActivity(Activity activity); 129 ScheduleItem(SchedulableItem item, bool isInAtomicTransaction, bool transacted, bool queueInTransaction)130 void ScheduleItem(SchedulableItem item, bool isInAtomicTransaction, bool transacted, bool queueInTransaction); ActivityStatusChanged(Activity activity, bool transacted, bool committed)131 void ActivityStatusChanged(Activity activity, bool transacted, bool committed); RaiseException(Exception e, Activity activity, string responsibleActivity)132 void RaiseException(Exception e, Activity activity, string responsibleActivity); 133 RaiseActivityExecuting(Activity activity)134 void RaiseActivityExecuting(Activity activity); RaiseHandlerInvoking(Delegate delegateHandler)135 void RaiseHandlerInvoking(Delegate delegateHandler); RaiseHandlerInvoked()136 void RaiseHandlerInvoked(); 137 StartWorkflow(Type workflowType, Dictionary<string, object> namedArgumentValues)138 Guid StartWorkflow(Type workflowType, Dictionary<string, object> namedArgumentValues); 139 140 // context activity related GetNewContextActivityId()141 int GetNewContextActivityId(); RegisterContextActivity(Activity activity)142 void RegisterContextActivity(Activity activity); UnregisterContextActivity(Activity activity)143 void UnregisterContextActivity(Activity activity); LoadContextActivity(ActivityExecutionContextInfo contextInfo, Activity outerContextActivity)144 Activity LoadContextActivity(ActivityExecutionContextInfo contextInfo, Activity outerContextActivity); SaveContextActivity(Activity contextActivity)145 void SaveContextActivity(Activity contextActivity); GetContextActivityForId(int id)146 Activity GetContextActivityForId(int id); GetService(Activity currentActivity, Type serviceType)147 Object GetService(Activity currentActivity, Type serviceType); PersistInstanceState(Activity activity)148 void PersistInstanceState(Activity activity); 149 150 //Dynamic change notifications OnBeforeDynamicChange(IList<WorkflowChangeAction> changes)151 bool OnBeforeDynamicChange(IList<WorkflowChangeAction> changes); OnAfterDynamicChange(bool updateSucceeded, IList<WorkflowChangeAction> changes)152 void OnAfterDynamicChange(bool updateSucceeded, IList<WorkflowChangeAction> changes); 153 bool IsDynamicallyUpdated { get; } 154 155 // root level access 156 Guid InstanceID { get; } SuspendInstance(string suspendDescription)157 bool SuspendInstance(string suspendDescription); TerminateInstance(Exception e)158 void TerminateInstance(Exception e); Resume()159 bool Resume(); CheckpointInstanceState(Activity currentActivity)160 void CheckpointInstanceState(Activity currentActivity); RequestRevertToCheckpointState(Activity currentActivity, EventHandler<EventArgs> callbackHandler, EventArgs callbackData, bool suspendOnRevert, string suspendReason)161 void RequestRevertToCheckpointState(Activity currentActivity, EventHandler<EventArgs> callbackHandler, EventArgs callbackData, bool suspendOnRevert, string suspendReason); DisposeCheckpointState()162 void DisposeCheckpointState(); 163 164 // User Tracking Track(string key, object data)165 void Track(string key, object data); 166 167 // Timer Events 168 WaitCallback ProcessTimersCallback { get; } 169 } 170 171 internal interface ITimerService 172 { ScheduleTimer(WaitCallback callback, Guid workflowInstanceId, DateTime whenUtc, Guid timerId)173 void ScheduleTimer(WaitCallback callback, Guid workflowInstanceId, DateTime whenUtc, Guid timerId); CancelTimer(Guid timerId)174 void CancelTimer(Guid timerId); 175 } 176 177 [Serializable()] 178 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 179 public sealed class WorkflowTerminatedException : Exception 180 { WorkflowTerminatedException(SerializationInfo info, StreamingContext context)181 private WorkflowTerminatedException(SerializationInfo info, StreamingContext context) 182 : base(info, context) 183 { 184 } 185 WorkflowTerminatedException()186 public WorkflowTerminatedException() 187 : base(SR.GetString(SR.Error_WorkflowTerminated)) 188 { 189 } 190 WorkflowTerminatedException(string message)191 public WorkflowTerminatedException(string message) 192 : base(message) 193 { 194 } WorkflowTerminatedException(string message, Exception exception)195 public WorkflowTerminatedException(string message, Exception exception) 196 : base(message, exception) 197 { 198 } 199 } 200 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 201 public interface ICompensatableActivity 202 { Compensate(ActivityExecutionContext executionContext)203 ActivityExecutionStatus Compensate(ActivityExecutionContext executionContext); 204 } 205 206 #region Class AlternateFlowActivityAttribute 207 208 [AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = false)] 209 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 210 public sealed class AlternateFlowActivityAttribute : Attribute 211 { 212 } 213 #endregion 214 215 #region Class SupportsTransactionAttribute 216 217 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] 218 internal sealed class SupportsTransactionAttribute : Attribute 219 { 220 } 221 #endregion 222 223 #region Class SupportsSynchronizationAttribute 224 225 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] 226 internal sealed class SupportsSynchronizationAttribute : Attribute 227 { 228 } 229 #endregion 230 231 #region Class PersistOnCloseAttribute 232 233 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] 234 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] 235 public sealed class PersistOnCloseAttribute : Attribute 236 { 237 } 238 #endregion 239 } 240