Share via


Publish Method (Type, PublishServiceCallback)

Publishes the given service type, but does not declare an instance yet. When someone requests the service the PublishServiceCallback will be invoked to create the instance. The callback is only invoked once and after that the instance it returned is cached. A generic version of this method is provided for convenience, and calls the non-generic method with appropriate casts.

Namespace:  Microsoft.Data.Tools.Design.Core.Context
Assembly:  Microsoft.Data.Tools.Design.Core (in Microsoft.Data.Tools.Design.Core.dll)

Syntax

'Declaration
Public MustOverride Sub Publish ( _
    serviceType As Type, _
    callback As PublishServiceCallback _
)
'Usage
Dim instance As ServiceCollection
Dim serviceType As Type
Dim callback As PublishServiceCallback

instance.Publish(serviceType, callback)
public abstract void Publish(
    Type serviceType,
    PublishServiceCallback callback
)
public:
virtual void Publish(
    Type^ serviceType, 
    PublishServiceCallback^ callback
) abstract
abstract Publish : 
        serviceType:Type * 
        callback:PublishServiceCallback -> unit 
public abstract function Publish(
    serviceType : Type, 
    callback : PublishServiceCallback
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

If serviceType or callback is null.

ArgumentException

If serviceType has already been published.

See Also

Reference

ServiceCollection Class

Publish Overload

Microsoft.Data.Tools.Design.Core.Context Namespace