Publish(TServiceType) Method (PublishServiceCallback(TServiceType))
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.
Namespace: Microsoft.Data.Tools.Design.Core.Context
Assembly: Microsoft.Data.Tools.Design.Core (in Microsoft.Data.Tools.Design.Core.dll)
Syntax
'Declaration
Public Sub Publish(Of TServiceType) ( _
callback As PublishServiceCallback(Of TServiceType) _
)
'Usage
Dim instance As ServiceCollection
Dim callback As PublishServiceCallback(Of TServiceType)
instance.Publish(callback)
public void Publish<TServiceType>(
PublishServiceCallback<TServiceType> callback
)
public:
generic<typename TServiceType>
void Publish(
PublishServiceCallback<TServiceType>^ callback
)
member Publish :
callback:PublishServiceCallback<'TServiceType> -> unit
JScript does not support generic types and methods.
Type Parameters
- TServiceType
Parameters
- callback
Type: Microsoft.Data.Tools.Design.Core.Context..::..PublishServiceCallback< (Of < ( <'TServiceType> ) > ) >
A callback to be invoked when the service is required.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | If callback is null. |
ArgumentException | If ServiceType has already been published. |