ServiceHelperGetServiceT Method (IServiceProvider, String) |
Namespace:
AGI.Foundation.Infrastructure
Assembly:
AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.3.420.0 (24.3.420.0)
Syntax public static T GetService<T>(
IServiceProvider serviceProvider,
string exceptionMessage
)
where T : class
Public Shared Function GetService(Of T As Class) (
serviceProvider As IServiceProvider,
exceptionMessage As String
) As T
public:
generic<typename T>
where T : ref class
static T GetService(
IServiceProvider^ serviceProvider,
String^ exceptionMessage
)
static member GetService :
serviceProvider : IServiceProvider *
exceptionMessage : string -> 'T when 'T : not struct
Parameters
- serviceProvider
- Type: SystemIServiceProvider
The service provider from which to obtain the service. - exceptionMessage
- Type: SystemString
An error message to include in the exception if the service is unavailable.
Type Parameters
- T
- The type of service to obtain.
Return Value
Type:
TThe requested service.
Exceptions See Also