GetRequiredService(TServiceType) Method
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.
Namespace: Microsoft.Data.Tools.Design.Core.Context
Assembly: Microsoft.Data.Tools.Design.Core (in Microsoft.Data.Tools.Design.Core.dll)
Syntax
'Declaration
Public Function GetRequiredService(Of TServiceType) As TServiceType
'Usage
Dim instance As ServiceCollection
Dim returnValue As TServiceType
returnValue = instance.GetRequiredService()
public TServiceType GetRequiredService<TServiceType>()
public:
generic<typename TServiceType>
TServiceType GetRequiredService()
member GetRequiredService : unit -> 'TServiceType
JScript does not support generic types and methods.
Type Parameters
- TServiceType
Return Value
Type: TServiceType
Exceptions
Exception | Condition |
---|---|
NotSupportedException | if there is no service of the given type. |