共用方式為


IServiceFactory.CreateAsync Method

Definition

Creates the service instance of T when requested.

public System.Threading.Tasks.Task<object> CreateAsync (Microsoft.ServiceHub.Framework.ServiceMoniker serviceMoniker, Microsoft.ServiceHub.Framework.ServiceActivationOptions activationOptions, IServiceProvider serviceProvider, Microsoft.ServiceHub.Framework.Services.AuthorizationServiceClient authorizationServiceClient, Type? instanceType, Type? interfaceType, System.Threading.CancellationToken cancellationToken);
abstract member CreateAsync : Microsoft.ServiceHub.Framework.ServiceMoniker * Microsoft.ServiceHub.Framework.ServiceActivationOptions * IServiceProvider * Microsoft.ServiceHub.Framework.Services.AuthorizationServiceClient * Type * Type * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
Public Function CreateAsync (serviceMoniker As ServiceMoniker, activationOptions As ServiceActivationOptions, serviceProvider As IServiceProvider, authorizationServiceClient As AuthorizationServiceClient, instanceType As Type, interfaceType As Type, cancellationToken As CancellationToken) As Task(Of Object)

Parameters

serviceMoniker
ServiceMoniker

Service moniker that was requested.

activationOptions
ServiceActivationOptions

Service activation options.

serviceProvider
IServiceProvider

Service provider for extension host services including service broker assigned to instance being created.

authorizationServiceClient
AuthorizationServiceClient

The authorization service for this brokered service to use. Must be disposed of by the service or the service factory, unless the service factory itself throws an exception.

instanceType
Type

Optional instance type if it was specified in the service registration.

interfaceType
Type

Optional interface type if it was specified in the service registration to indicate the interface being queried.

cancellationToken
CancellationToken

Cancellation token to monitor.

Returns

a Task returning instance of the service object.

Applies to