Sdílet prostřednictvím


WorkflowRuntime.RemoveService(Object) Metoda

Definice

Odebere zadanou službu z modulu runtime pracovního postupu.

public:
 void RemoveService(System::Object ^ service);
public void RemoveService (object service);
member this.RemoveService : obj -> unit
Public Sub RemoveService (service As Object)

Parametry

service
Object

Objekt, který představuje službu, která se má odebrat.

Výjimky

serviceje odkaz na hodnotu null (Nothing v Visual Basic).

Spuštěný modul běhu pracovního postupu (IsStarted je true) a service je základní službou.

-nebo- service není zaregistrovaný v modulu runtime pracovního postupu.

Příklady

V následujícím příkladu SqlWorkflowPersistenceService se přidá a odebere ze souboru WorkflowRuntime.

// Create a new workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Create a new instance of the out-of-box SqlWorkflowPersistenceService
SqlWorkflowPersistenceService persistenceService =
   new SqlWorkflowPersistenceService(
   "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;");
// Add the service to the runtime
workflowRuntime.AddService(persistenceService);
// Start the runtime
workflowRuntime.StartRuntime();
// Stop the runtime
workflowRuntime.StopRuntime();
// Remove the service from the runtime
workflowRuntime.RemoveService(persistenceService);
' Create a new workflow runtime
Dim workflowRuntime As New WorkflowRuntime()
' Create a new instance of the out-of-box SqlWorkflowPersistenceService
Dim persistenceService As New SqlWorkflowPersistenceService( _
   "Initial Catalog=SqlPersistenceServiceData Source=localhostIntegrated Security=SSPI")
' Add the service to the runtime
workflowRuntime.AddService(persistenceService)
' Start the runtime
workflowRuntime.StartRuntime()
' Stop the runtime
workflowRuntime.StopRuntime()
' Remove the service from the runtime
workflowRuntime.RemoveService(persistenceService)

Poznámky

Základní službu nelze odebrat, když běží modul runtime pracovního postupu (IsStarted je true). Základní služby jsou služby odvozené od WorkflowSchedulerService třídy, WorkflowCommitWorkBatchService třídy, WorkflowPersistenceService třídy nebo TrackingService třídy. Pokud service je odvozena z WorkflowRuntimeService třídy, RemoveService volá metodu Stop implementovanou .service

Platí pro