Share via


ReceiveActivity.SetWorkflowServiceAttributes(Object, Object) 方法

定義

設定由 ReceiveActivity 活動所實作的服務之屬性。 這些屬性包括諸多項目,如 AddressFilterModeConfigurationName,以及是否要在 ReceiveActivity 活動所傳回的每個錯誤中包含例外狀況詳細資訊。

public:
 static void SetWorkflowServiceAttributes(System::Object ^ dependencyObject, System::Object ^ value);
public static void SetWorkflowServiceAttributes (object dependencyObject, object value);
static member SetWorkflowServiceAttributes : obj * obj -> unit
Public Shared Sub SetWorkflowServiceAttributes (dependencyObject As Object, value As Object)

參數

dependencyObject
Object

要套用服務屬性的物件。

value
Object

包含要套用之服務屬性資料的 WorkflowServiceAttributes 物件。

範例

下列範例會示範如何使用 SetWorkflowServiceAttributes 方法。

WorkflowServiceAttributes attributes = new WorkflowServiceAttributes();
attributes.ConfigurationName = "ServiceConfig";
attributes.IncludeExceptionDetailInFaults = true;
attributes.AddressFilterMode = AddressFilterMode.Exact;

ReceiveActivity.SetWorkflowServiceAttributes(receiveActivity1, attributes);

備註

WorkflowServiceAttributesProperty 屬性是一個附加的相依性屬性,由 ReceiveActivity 活動所定義。 相依性屬性會附加至根工作流程,此工作流程內含在設計階段時使用 ReceiveActivity 方法呼叫的 SetWorkflowServiceAttributes 活動。

定義的服務層級行為屬性會使用 WorkflowServiceAttributesProperty 屬性,當工作流程服務啟動時,這些行為屬性會套用至工作流程服務。 這些行為屬性無法在執行階段修改。

注意

若目前的工作流程使用 InvokeWorkflowActivity 活動來啟動另一個工作流程,則被叫用的工作流程不會繼承叫用者工作流程的服務屬性。

注意

如果有針對自訂活動設定服務屬性,且該活動包含於工作流程中,這時不會使用那些服務屬性。 只有在自訂活動做為工作流程來執行時,服務屬性才會用於自訂活動。

適用於