WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager) 方法


由主機呼叫,以註冊指定的擴充管理員、驗證所有必要的擴充均存在,並且初始化要使用的擴充集合。Called by the host to register the specified extension manager, validate that all required extensions are present, and to initialize the collection of extensions to be used.

 void RegisterExtensionManager(System::Activities::Hosting::WorkflowInstanceExtensionManager ^ extensionManager);
protected void RegisterExtensionManager (System.Activities.Hosting.WorkflowInstanceExtensionManager extensionManager);
member this.RegisterExtensionManager : System.Activities.Hosting.WorkflowInstanceExtensionManager -> unit
Protected Sub RegisterExtensionManager (extensionManager As WorkflowInstanceExtensionManager)



要註冊的擴充管理員。The extension manager to register.


擴充會以型別做為索引鍵,若主機提供了擴充,則一律使用主機所提供的擴充。Extensions are keyed by type, and a host provided extension will always be used if provided. 透過 Add 加入的擴充會使用物件的執行階段型別做為型別索引鍵。Extensions added through Add use the runtime type of the object as the type key. 透過Add新增的延伸模組提供者,會使用 Func<T > 的 decared 類型 T 做為類型索引鍵。Extensions providers added through Add use the decared type T of the Func<T> as the type key. 如果已宣告型別的主機擴充存在,或者透過 AddDefaultExtensionProvider 提供了更廣泛的型別,則會卸除活動透過各種 *ActivityMetadata.AddDefaultExtensionProvider 方法所提供的擴充提供者 (例如,Extension providers contributed by activities through the various *ActivityMetadata.AddDefaultExtensionProvider methods are dropped if a host extension exists for the declared type or if there is a broader type provided through AddDefaultExtensionProvider (ex. 如果提供<了 func StreamWriter >,而且<提供了 func 的無效 >,<則只會保留 func StreamWriter >)。if Func<StreamWriter> is provided and Func<TextWriter> is provided, only Func<StreamWriter> will be kept). 如果集合中不具有活動所要求的擴充 (透過呼叫 *ActivityMetadata.RequireExtension 表示),則會擲回 ValidationExceptionIf an extension does not exist in the collection that is required by an activity (expressed by calling *ActivityMetadata.RequireExtension) a ValidationException is thrown.