ThrowActivity Класс
Определение
Внимание!
The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*
Моделирует создание исключения.Models the throwing of an exception. Этот класс не наследуется.This class cannot be inherited.
public ref class ThrowActivity sealed : System::Workflow::ComponentModel::Activity, System::Workflow::ComponentModel::Design::ITypeFilterProvider, System::Workflow::ComponentModel::IDynamicPropertyTypeProvider
[System.Drawing.ToolboxBitmap(typeof(System.Workflow.ComponentModel.ThrowActivity), "Resources.Throw.png")]
public sealed class ThrowActivity : System.Workflow.ComponentModel.Activity, System.Workflow.ComponentModel.Design.ITypeFilterProvider, System.Workflow.ComponentModel.IDynamicPropertyTypeProvider
[System.Drawing.ToolboxBitmap(typeof(System.Workflow.ComponentModel.ThrowActivity), "Resources.Throw.png")]
[System.Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public sealed class ThrowActivity : System.Workflow.ComponentModel.Activity, System.Workflow.ComponentModel.Design.ITypeFilterProvider, System.Workflow.ComponentModel.IDynamicPropertyTypeProvider
[<System.Drawing.ToolboxBitmap(typeof(System.Workflow.ComponentModel.ThrowActivity), "Resources.Throw.png")>]
type ThrowActivity = class
inherit Activity
interface ITypeFilterProvider
interface IDynamicPropertyTypeProvider
[<System.Drawing.ToolboxBitmap(typeof(System.Workflow.ComponentModel.ThrowActivity), "Resources.Throw.png")>]
[<System.Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")>]
type ThrowActivity = class
inherit Activity
interface ITypeFilterProvider
interface IDynamicPropertyTypeProvider
Public NotInheritable Class ThrowActivity
Inherits Activity
Implements IDynamicPropertyTypeProvider, ITypeFilterProvider
- Наследование
- Атрибуты
- Реализации
Примеры
В следующем примере кода показано использование одного действия создания исключения в рабочем процессе, чтобы реализовать обработку исключений.The following code shows the use of a single throw activity in a workflow to implement exception handling. Данный пример кода является частью примера SDK "Throw" из файла ThrowWorkflow.cs.This code example is part of the Throw SDK sample and is from the ThrowWorkflow.cs file. Дополнительные сведения см. в разделе Использование инструкции Throw.For more information, see Using Throw.
public sealed partial class ThrowWorkflow : SequentialWorkflowActivity
{
[System.Diagnostics.DebuggerNonUserCode()]
private void InitializeComponent()
{
this.CanModifyActivities = true;
System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
this.throwActivity1 = new System.Workflow.ComponentModel.ThrowActivity();
activitybind1.Name = "ThrowWorkflow";
activitybind1.Path = "ThrownException";
//
// throwActivity1
//
this.throwActivity1.Name = "throwActivity1";
this.throwActivity1.SetBinding(System.Workflow.ComponentModel.ThrowActivity.FaultProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
//
// ThrowWorkflow
//
this.Activities.Add(this.throwActivity1);
this.Name = "ThrowWorkflow";
this.CanModifyActivities = false;
}
private Exception thrownExceptionValue = new System.Exception("My Exception Message.");
public Exception ThrownException
{
get { return thrownExceptionValue; }
set { thrownExceptionValue = value; }
}
private ThrowActivity throwActivity1;
}
Partial Public NotInheritable Class ThrowWorkflow
Inherits SequentialWorkflowActivity
<System.Diagnostics.DebuggerNonUserCode()> _
Private Sub InitializeComponent()
Me.CanModifyActivities = True
Dim activitybind1 As New System.Workflow.ComponentModel.ActivityBind()
Me.throwActivity1 = New System.Workflow.ComponentModel.ThrowActivity()
activitybind1.Name = "ThrowWorkflow"
activitybind1.Path = "ThrownException"
'
' throwActivity1
'
Me.throwActivity1.Name = "throwActivity1"
Me.throwActivity1.SetBinding(System.Workflow.ComponentModel.ThrowActivity.FaultProperty, activitybind1)
'
' ThrowWorkflow
'
Me.Activities.Add(Me.throwActivity1)
Me.Name = "ThrowWorkflow"
Me.CanModifyActivities = False
End Sub
Private thrownExceptionValue As New System.Exception("My Exception Message.")
Public Property ThrownException() As Exception
Get
Return thrownExceptionValue
End Get
Set(ByVal value As Exception)
thrownExceptionValue = value
End Set
End Property
Private throwActivity1 As ThrowActivity
End Class
Комментарии
Примечание
В этом материале обсуждаются устаревшие типы и пространства имен.This material discusses types and namespaces that are obsolete. Дополнительные сведения см. в статье о нерекомендуемых типах в Windows Workflow Foundation 4.5.For more information, see Deprecated Types in Windows Workflow Foundation 4.5.
Назначение класса ThrowActivity — сделать возможным декларативное моделирование процесса создания исключения.The purpose of the ThrowActivity is to allow declarative modeling of the throwing of an exception. Класс ThrowActivity функционально эквивалентен действию CodeActivity, обработчик побочного кода которого создает указанное исключение.The ThrowActivity is functionally equivalent to a CodeActivity activity whose code-beside handler throws the indicated exception.
Конструкторы
ThrowActivity() |
Инициализирует новый экземпляр класса ThrowActivity.Initializes a new instance of the ThrowActivity class. |
ThrowActivity(String) |
Инициализирует новый экземпляр класса ThrowActivity и его имя.Initializes a new instance of the ThrowActivity class, and initializes its name. |
Поля
FaultProperty |
DependencyProperty, представляющий свойство Fault этого экземпляра.The DependencyProperty representing the Fault property for this instance. |
FaultTypeProperty |
DependencyProperty, представляющий свойство FaultType этого экземпляра.The DependencyProperty representing the FaultType property for this instance. |
Свойства
Description |
Возвращает или задает пользовательское описание объекта Activity.Gets or sets the user-defined description of the Activity. (Унаследовано от Activity) |
DesignMode |
Возвращает значение, показывающее, в каком режиме находится данный экземпляр — режиме конструктора или режиме выполнения.Gets the value that indicates whether this instance is in design or run-time mode. (Унаследовано от DependencyObject) |
Enabled |
Возвращает или задает значение, указывающее, разрешены ли для этого экземпляра выполнение и проверка.Gets or sets a value that indicates whether this instance is enabled for execution and validation. (Унаследовано от Activity) |
ExecutionResult |
Возвращает результат ActivityExecutionResult последней попытки запуска экземпляра.Gets the ActivityExecutionResult of the last attempt to run this instance. (Унаследовано от Activity) |
ExecutionStatus |
Возвращает текущее состояние ActivityExecutionStatus экземпляра.Gets the current ActivityExecutionStatus of this instance. (Унаследовано от Activity) |
Fault |
Получает или задает объект исключения, который должен быть создан действием ThrowActivity.Gets or sets the exception object that should be thrown by the ThrowActivity. |
FaultType |
Получает или задает тип выполнения, должен быть создан объектом ThrowActivity.Gets or sets the type of exception that should be thrown by the ThrowActivity. |
IsDynamicActivity |
Возвращает сведения о том, выполняется ли действие в рамках ActivityExecutionContext по умолчанию для экземпляра рабочего процесса.Gets information about whether the activity is executing within the default ActivityExecutionContext of the workflow instance. (Унаследовано от Activity) |
Name |
Возвращает или задает имя экземпляра.Gets or sets the name of this instance. Имя должно соответствовать стандартным правилам именования переменных языка программирования, использованного в проекте.This name must conform to the variable naming convention of the programming language that is being used in the Workflow project. (Унаследовано от Activity) |
Parent |
Возвращает составное действие CompositeActivity, в котором содержится данный объект Activity.Gets the CompositeActivity that contains this Activity. (Унаследовано от Activity) |
ParentDependencyObject |
Возвращает родительский объект DependencyObject в графе DependencyObject.Gets the parent DependencyObject in the DependencyObject graph. (Унаследовано от DependencyObject) |
QualifiedName |
Возвращает полное имя действия.Gets the qualified name of the activity. Полные имена действий всегда уникальны в рамках экземпляра рабочего процесса.Qualified activity names are always unique in a workflow instance. (Унаследовано от Activity) |
Site |
Возвращает или задает ссылку на компонент Site объекта DependencyObject.Gets or sets a reference to the Site component of the DependencyObject. (Унаследовано от DependencyObject) |
UserData |
Возвращает коллекцию IDictionary, которая связывает пользовательские данные с этим экземпляром класса.Gets an IDictionary that associates custom data with this class instance. (Унаследовано от DependencyObject) |
WorkflowInstanceId |
Возвращает идентификатор Guid, связанный с экземпляром.Gets the Guid associated with the instance. (Унаследовано от Activity) |
Методы
AddHandler(DependencyProperty, Object) |
Добавляет обработчик для события DependencyObject.Adds a handler for an event of a DependencyObject. (Унаследовано от DependencyObject) |
Cancel(ActivityExecutionContext) |
Вызывается средой выполнения рабочих процессов для отмены выполнения действия, которое выполняется в настоящий момент.Called by the workflow runtime to cancel execution of an activity that is currently executing. (Унаследовано от Activity) |
Clone() |
Создает глубокую копию объекта Activity.Creates a deep copy of the Activity. (Унаследовано от Activity) |
Dispose() |
Освобождает все ресурсы, используемые объектом DependencyObject.Releases all the resources used by the DependencyObject. (Унаследовано от DependencyObject) |
Dispose(Boolean) |
Освобождает неуправляемые ресурсы и факультативно освобождает управляемые ресурсы, используемые объектом DependencyObject.Releases the unmanaged resources and optionally releases the managed resources used by DependencyObject. (Унаследовано от DependencyObject) |
Equals(Object) |
Определяет, равен ли указанный объект текущему объекту.Determines whether the specified object is equal to the current object. (Унаследовано от Object) |
Execute(ActivityExecutionContext) |
Вызывается средой выполнения рабочих процессов для выполнения действия.Called by the workflow runtime to execute an activity. (Унаследовано от Activity) |
GetActivityByName(String) |
Возвращает экземпляр Activity, имя которого запрошено, из набора всех действий, выполняемых в рамках корневого действия экземпляра, то есть в рамках рабочего процесса.Returns the instance of the Activity whose name is requested from the set of all activities running under the root activity of this instance, which is within the workflow. (Унаследовано от Activity) |
GetActivityByName(String, Boolean) |
Возвращает экземпляр Activity, имя которого запрошено, из набора всех действий, выполняемых в рамках корневого действия Activity экземпляра, если второй параметр имеет значение |
GetBinding(DependencyProperty) |
Предоставляет доступ к объекту ActivityBind, связанному с конкретным объектом DependencyProperty.Provides access to the ActivityBind associated with the specific DependencyProperty. (Унаследовано от DependencyObject) |
GetBoundValue(ActivityBind, Type) |
Извлекает объект Object, который является субъектом ActivityBind.Retrieves the Object that is the subject of an ActivityBind. (Унаследовано от DependencyObject) |
GetHashCode() |
Служит хэш-функцией по умолчанию.Serves as the default hash function. (Унаследовано от Object) |
GetInvocationList<T>(DependencyProperty) |
Возвращает массив, содержащий делегаты для заданного свойства DependencyProperty.Gets an array that contains the delegates for the specified DependencyProperty. (Унаследовано от DependencyObject) |
GetType() |
Возвращает объект Type для текущего экземпляра.Gets the Type of the current instance. (Унаследовано от Object) |
GetValue(DependencyProperty) |
Предоставляет доступ к значению заданного свойства DependencyProperty.Provides access to the value of the designated DependencyProperty. (Унаследовано от DependencyObject) |
GetValueBase(DependencyProperty) |
Предоставляет доступ к связанному объекту DependencyProperty и обходит переопределение метода GetValue(DependencyProperty).Provides access to the bound object of a DependencyProperty and bypasses the GetValue(DependencyProperty) override. (Унаследовано от DependencyObject) |
HandleFault(ActivityExecutionContext, Exception) |
Вызывается при возникновении исключения в контексте выполнения данного экземпляра.Called when an exception is raised within the context of the execution of this instance. (Унаследовано от Activity) |
Initialize(IServiceProvider) |
Вызывается средой выполнения рабочих процессов для инициализации действия во время создания нового экземпляра рабочего процесса.Called by the workflow runtime to initialize an activity during the construction of a new workflow instance. Метод вызывается во время создания динамического объекта ActivityExecutionContext.This method is called during the construction of a dynamic ActivityExecutionContext. (Унаследовано от Activity) |
InitializeProperties() |
При переопределении в производном классе выполняет инициализацию свойств зависимостей.Performs initialization on dependency properties when overridden in a derived class. (Унаследовано от DependencyObject) |
Invoke<T>(EventHandler<T>, T) |
Подписывает объект EventHandler и вызывает делегат.Subscribes an EventHandler and invokes that delegate. (Унаследовано от Activity) |
Invoke<T>(IActivityEventListener<T>, T) |
Подписывает объект IActivityEventListener<T> и вызывает делегат.Subscribes an IActivityEventListener<T> and invokes that delegate. (Унаследовано от Activity) |
IsBindingSet(DependencyProperty) |
Указывает, задано ли значение DependencyProperty как привязка.Indicates whether the value of a DependencyProperty is set as a binding. См. раздел SetBinding(DependencyProperty, ActivityBind).See SetBinding(DependencyProperty, ActivityBind). (Унаследовано от DependencyObject) |
MemberwiseClone() |
Создает неполную копию текущего объекта Object.Creates a shallow copy of the current Object. (Унаследовано от Object) |
MetaEquals(DependencyObject) |
Определяет, совпадают ли свойства |
OnActivityExecutionContextLoad(IServiceProvider) |
Вызывается средой выполнения рабочих процессов при каждой загрузке объекта ActivityExecutionContext.Called by the workflow runtime whenever an ActivityExecutionContext is loaded. Например, этот метод вызывается во время создания объекта ActivityExecutionContext, а также при каждом повторном воплощении объекта ActivityExecutionContext во время загрузки экземпляра рабочего процесса из постоянного хранилища.For example, this method is called during the creation of an ActivityExecutionContext as well as every time the ActivityExecutionContext is reincarnated when a workflow instance is loaded from persistent storage. (Унаследовано от Activity) |
OnActivityExecutionContextUnload(IServiceProvider) |
Вызывается средой выполнения рабочих процессов каждый раз, как выгружается объект ActivityExecutionContext.Called by the workflow runtime whenever an ActivityExecutionContext is unloaded. Например, этот метод вызывается во время завершения ActivityExecutionContext, а также каждый раз при выгрузке объекта ActivityExecutionContext, если экземпляр рабочего процесса сохраняется.For example, this method is called during completion of an ActivityExecutionContext as well as every time the ActivityExecutionContext is unloaded when a workflow instance is persisted. (Унаследовано от Activity) |
OnClosed(IServiceProvider) |
Вызывается средой выполнения рабочих процессов и является частью перехода действия в закрытое состояние.Called by the workflow runtime as part of the activity's transition to the closed state. (Унаследовано от Activity) |
RaiseEvent(DependencyProperty, Object, EventArgs) |
Вызывает событие Event, связанное с заданным свойством зависимостей.Raises an Event associated with the specified dependency property. (Унаследовано от Activity) |
RaiseGenericEvent<T>(DependencyProperty, Object, T) |
Порождает событие, связанное с объектом DependencyProperty, на который существует ссылка.Raises the event associated with the referenced DependencyProperty. (Унаследовано от Activity) |
RegisterForStatusChange(DependencyProperty, IActivityEventListener<ActivityExecutionStatusChangedEventArgs>) |
Регистрирует заданный объект DependencyProperty для события изменения состояния.Registers the specified DependencyProperty for the status change event. (Унаследовано от Activity) |
RemoveHandler(DependencyProperty, Object) |
Удаляет EventHandler из связанного объекта DependencyProperty.Removes an EventHandler from an associated DependencyProperty. (Унаследовано от DependencyObject) |
RemoveProperty(DependencyProperty) |
Удаляет объект DependencyProperty из объекта DependencyObject.Removes a DependencyProperty from the DependencyObject. (Унаследовано от DependencyObject) |
Save(Stream) |
Записывает действие Activity в объект Stream для сохранения.Writes the Activity to a Stream for persistence. (Унаследовано от Activity) |
Save(Stream, IFormatter) |
Записывает действие Activity в объект Stream для сохранения, применяя пользовательский интерфейс IFormatter для сериализации.Writes the Activity to a Stream for persistence using the custom IFormatter provided for serialization. (Унаследовано от Activity) |
SetBinding(DependencyProperty, ActivityBind) |
Задает объект ActivityBind для указанного объекта DependencyProperty.Sets the ActivityBind for the specified DependencyProperty. (Унаследовано от DependencyObject) |
SetBoundValue(ActivityBind, Object) |
Задает значение целевого объекта ActivityBind.Sets the value of the target ActivityBind. (Унаследовано от DependencyObject) |
SetReadOnlyPropertyValue(DependencyProperty, Object) |
Задает значение свойства DependencyProperty только для чтения.Sets the value of a DependencyProperty, which is read-only. (Унаследовано от DependencyObject) |
SetValue(DependencyProperty, Object) |
Присваивает значение DependencyProperty объекту.Sets the value of the DependencyProperty to the object. (Унаследовано от DependencyObject) |
SetValueBase(DependencyProperty, Object) |
Задает значение свойства DependencyProperty равным указанному объекту Object в обход метода SetValue(DependencyProperty, Object).Sets the value of the DependencyProperty to the specified Object, bypassing the SetValue(DependencyProperty, Object). (Унаследовано от DependencyObject) |
ToString() |
Возвращает строку, представляющую данный экземпляр.Provides a string that represents this instance. (Унаследовано от Activity) |
TrackData(Object) |
Передает в инфраструктуру отслеживания среды выполнения отложенные сведения об отслеживании.Informs the run-time tracking infrastructure of pending tracking information. (Унаследовано от Activity) |
TrackData(String, Object) |
Передает в инфраструктуру отслеживания среды выполнения отложенные сведения об отслеживании.Informs the run-time tracking infrastructure of pending tracking information. (Унаследовано от Activity) |
Uninitialize(IServiceProvider) |
При переопределении в производном классе обеспечивает деинициализацию поставщиком служб для действия.When overridden in a derived class, provides un-initialization by a service provider for the activity. (Унаследовано от Activity) |
UnregisterForStatusChange(DependencyProperty, IActivityEventListener<ActivityExecutionStatusChangedEventArgs>) |
Отменяет регистрацию заданного объекта DependencyProperty для события изменения состояния.Un-registers the specified DependencyProperty for the status change event. (Унаследовано от Activity) |
События
Canceling |
Происходит при отмене выполнения действия.Occurs when the activity execution is canceled. (Унаследовано от Activity) |
Closed |
Происходит при завершении выполнения действия Activity.Occurs when an Activity has completed execution. (Унаследовано от Activity) |
Compensating |
Происходит при выполнении метода компенсации для действия Activity.Occurs when running a compensation method on the Activity. (Унаследовано от Activity) |
Executing |
Происходит при выполнении действия Activity.Occurs when the Activity is run. (Унаследовано от Activity) |
Faulting |
Происходит при возникновении исключения во время выполнения экземпляра.Occurs when an exception is raised during the running of the instance. (Унаследовано от Activity) |
StatusChanged |
Происходит при изменении состояния ActivityExecutionStatus действия Activity.Occurs when the ActivityExecutionStatus of a running Activity changes. (Унаследовано от Activity) |
Явные реализации интерфейса
IComponent.Disposed |
Представляет метод, обрабатывающий событие Disposed компонента.Represents the method that handles the Disposed event of a component. (Унаследовано от DependencyObject) |
IDynamicPropertyTypeProvider.GetAccessType(IServiceProvider, String) |
Возвращает тип доступа для заданного свойства.Returns the access type for the specified property. |
IDynamicPropertyTypeProvider.GetPropertyType(IServiceProvider, String) |
Возвращает тип Type заданного свойства.Returns the Type of the specified property. |
ITypeFilterProvider.CanFilterType(Type, Boolean) |
Возвращает значение, указывающее, можно ли фильтровать указанный тип Type.Returns a value that indicates whether the specified Type can be filtered. |
ITypeFilterProvider.FilterDescription |
Возвращает описание фильтра, который будет выведен в диалоговом окне браузера классов.Gets the description for the filter to be displayed on the class browser dialog box. |