แก้ไข

แชร์ผ่าน


ServiceManager.Publish Method

Definition

Publishes the given service type, but does not declare an instance. When the service is requested, the Publish service callback will be invoked to create the instance. The callback is invoked only once. After that, the instance it returned is cached.

Overloads

Publish(Type, Object)

Publishes the given service. After it is published, the service instance remains in the service manager until the editing context is disposed of.

Publish(Type, PublishServiceCallback)

Publishes the specified service type, but does not declare an instance. When the service is requested, the Publish service callback will be invoked to create the instance. The callback is invoked only once. After that, the instance it returned is cached.

Publish<TServiceType>(PublishServiceCallback<TServiceType>)

Publishes the given service type, but does not declare an instance yet. When the service is requested, the PublishServiceCallback will be invoked to create the instance. The callback is invoked only once. After that, the instance it returned is cached.

Publish<TServiceType>(TServiceType)

Publishes the given service. After it is published, the service instance remains in the service manager until the editing context is disposed of.

Publish(Type, Object)

Publishes the given service. After it is published, the service instance remains in the service manager until the editing context is disposed of.

public:
 abstract void Publish(Type ^ serviceType, System::Object ^ serviceInstance);
public abstract void Publish (Type serviceType, object serviceInstance);
abstract member Publish : Type * obj -> unit
Public MustOverride Sub Publish (serviceType As Type, serviceInstance As Object)

Parameters

serviceType
Type

The type of service to publish.

serviceInstance
Object

An instance of the service.

Exceptions

serviceType or serviceInstance is null.

serviceInstance does not derive from or implement serviceType, or serviceType has already been published.

Applies to

Publish(Type, PublishServiceCallback)

Publishes the specified service type, but does not declare an instance. When the service is requested, the Publish service callback will be invoked to create the instance. The callback is invoked only once. After that, the instance it returned is cached.

public:
 abstract void Publish(Type ^ serviceType, System::Activities::Presentation::PublishServiceCallback ^ callback);
public abstract void Publish (Type serviceType, System.Activities.Presentation.PublishServiceCallback callback);
abstract member Publish : Type * System.Activities.Presentation.PublishServiceCallback -> unit
Public MustOverride Sub Publish (serviceType As Type, callback As PublishServiceCallback)

Parameters

serviceType
Type

The type of service to publish.

callback
PublishServiceCallback

A callback that will be invoked when an instance of the service is needed.

Exceptions

serviceType or callback is null.

serviceType has already been published.

Applies to

Publish<TServiceType>(PublishServiceCallback<TServiceType>)

Publishes the given service type, but does not declare an instance yet. When the service is requested, the PublishServiceCallback will be invoked to create the instance. The callback is invoked only once. After that, the instance it returned is cached.

public:
generic <typename TServiceType>
 void Publish(System::Activities::Presentation::PublishServiceCallback<TServiceType> ^ callback);
public void Publish<TServiceType> (System.Activities.Presentation.PublishServiceCallback<TServiceType> callback);
member this.Publish : System.Activities.Presentation.PublishServiceCallback<'ServiceType> -> unit
Public Sub Publish(Of TServiceType) (callback As PublishServiceCallback(Of TServiceType))

Type Parameters

TServiceType

The type of the service to publish.

Parameters

callback
PublishServiceCallback<TServiceType>

A callback that will be invoked when an instance of the service is needed.

Exceptions

callback is null.

Applies to

Publish<TServiceType>(TServiceType)

Publishes the given service. After it is published, the service instance remains in the service manager until the editing context is disposed of.

public:
generic <typename TServiceType>
 void Publish(TServiceType serviceInstance);
public void Publish<TServiceType> (TServiceType serviceInstance);
member this.Publish : 'ServiceType -> unit
Public Sub Publish(Of TServiceType) (serviceInstance As TServiceType)

Type Parameters

TServiceType

The type of the service to publish.

Parameters

serviceInstance
TServiceType

An instance of the service.

Exceptions

serviceInstance is null.

Applies to