Search

Search:

Namespace:

Search Result
.

One of the more frequently used functions is the GetService which return one of the configured RuntimeServices.

.
        Dim wqs As WorkflowQueuingService = executionContext.GetService(Of WorkflowQueuingService)()
.
        Dim wqs As WorkflowQueuingService = executionContext.GetService(Of WorkflowQueuingService)()
.
        Dim wqs As WorkflowQueuingService = executionContext.GetService(Of WorkflowQueuingService)()
.

The GetService function can be used inside of an activity to return a reference to one of the BaseRuntimeServices derived classes that have been added to the WorkflowRuntime.

.

The GetService function is defined on a number of classes and interfaces like WorkflowRuntime, ActivityExecutionContext, ExternalDataExchangeService and IServiceProvider.

.

Depending on the object used to call GetService a number of RuntimeServices might not be returned, a null/Nothing is returned instead. This is the case with a ActivityExecutionContext which will not return any of the following: WorkflowSchedulerService, WorkflowPersistenceService, TrackingService, WorkflowCommitWorkBatchService, WorkflowLoaderService or the WorkflowRuntime itself.

.
        Dim wqs As WorkflowQueuingService = context.GetService(Of WorkflowQueuingService)()
.
        ManualWorkflowSchedulerService scheduler = workflowRuntime.GetService<ManualWorkflowSchedulerService>();
.
        IDisplayMessageService service = executionContext.GetService<IDisplayMessageService>();
.

The basics are the same as in my previous IronPython post. Depending on the display mode I make a choice of class to load and I use the same code as previous time to create the object. Finally I add it to the WorkflowRuntime as a runtime service. This last bit is easy as this accepts every object type as a valid service and only when we call the GetService do we check the actual type.

.
        Dim designerHost As IDesignerHost = Me.GetService(GetType(IDesignerHost))
.
            WorkflowQueuingService wqs = executionContext.GetService<WorkflowQueuingService>();
.
            WriteLineService3 service = executionContext.GetService<WriteLineService3>();
.
        executionContext.GetService<WriteLineService3>();
.
        executionContext.GetService<WorkflowQueuingService>();
.
        executionContext.GetService<WriteLineService3>();
.
                executionContext.GetService<WriteLineService2>();
.
        executionContext.GetService<WriteLineService2>();
.

When creating a subclass overrule the abstract PerformLoad function to load the workflow. Use the GetService function to retreive a IDesignerHost reference and use its Container object to add all the workflow activities to the designer surface. See the WorkflowUtils GetAllActivities function for an easy way to get a reference to all nested activities.