Share via


ServiceCollection Class

The service collection implements IServiceProvider and provides access to services offered by the editing context.

Inheritance Hierarchy

System..::..Object
  Microsoft.Data.Tools.Design.Core.Context..::..ServiceCollection

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

Syntax

'Declaration
Public MustInherit Class ServiceCollection _
    Implements IServiceProvider, IEnumerable(Of Type),  _
    IEnumerable
'Usage
Dim instance As ServiceCollection
public abstract class ServiceCollection : IServiceProvider, 
    IEnumerable<Type>, IEnumerable
public ref class ServiceCollection abstract : IServiceProvider, 
    IEnumerable<Type^>, IEnumerable
[<AbstractClassAttribute>]
type ServiceCollection =  
    class
        interface IServiceProvider
        interface IEnumerable<Type>
        interface IEnumerable
    end
public abstract class ServiceCollection implements IServiceProvider, IEnumerable<Type>, IEnumerable

The ServiceCollection type exposes the following members.

Constructors

  Name Description
Protected method ServiceCollection Creates a new ServiceCollection.

Top

Methods

  Name Description
Public method Contains(Type) Returns true if the service collection contains a service of the given type.
Public method Contains< (Of < <' (TServiceType> ) > > )() () () () Returns true if the service collection contains a service of the given type.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetEnumerator Retrives an enumerator that can be used to enumerate all of the services that this service collection publishes.
Public method GetHashCode (Inherited from Object.)
Public method GetRequiredService< (Of < <' (TServiceType> ) > > ) Retrives the requested service. Unlike GetService, GetRequiredService throws a NotSupportedException if the service isn?t available. The reason we provide this method, and not a normal GetService method is our wish to move services to a more reliable contract.
Public method GetService(Type) Retrives the requested service. This method returns null if the service could not be located.
Public method GetService< (Of < <' (TServiceType> ) > > )() () () () Retrives the requested service. This method returns null if the service could not be located.
Protected methodStatic member GetTarget This is a helper method that returns the target object for a delegate. If the delegate was created to proxy a generic delegate, this will correctly return the original object, not the proxy.
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method Publish(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.
Public method Publish(Type, Object) Publishes the given service. Once published, the service instance remains in the service collection until the editing context is disposed.
Public method Publish< (Of < <' (TServiceType> ) > > )(TServiceType) Publishes the given service. Once published, the service instance remains in the service collection until the editing context is disposed.
Public method Publish< (Of < <' (TServiceType> ) > > )(PublishServiceCallback< (Of < <' (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.
Protected methodStatic member RemoveCallback This is a helper method that performs a Delegate.Remove, but knows how to unwrap delegates that are proxies to generic callbacks. Use this in your Unsubscribe implementations.
Public method Subscribe(Type, SubscribeServiceCallback) Calls back on the provided callback when someone has published the requested service. If the service was already available, this method invokes the callback immediately. A generic version of this method is provided for convenience, and calls the non-generic method with appropriate casts.
Public method Subscribe< (Of < <' (TServiceType> ) > > )(SubscribeServiceCallback< (Of < <' (TServiceType> ) > > )) Calls back on the provided callback when someone has published the requested service. If the service was already available, this method invokes the callback immediately. A generic version of this method is provided for convenience, and calls the non-generic method with appropriate casts.
Public method ToString (Inherited from Object.)
Public method Unsubscribe(Type, SubscribeServiceCallback) Removes a subscription for the serviceType.
Public method Unsubscribe< (Of < <' (TServiceType> ) > > )(SubscribeServiceCallback< (Of < <' (TServiceType> ) > > )) Removes a subscription for the ServiceType.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IEnumerable..::..GetEnumerator Implementation of default IEnumerable.

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

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