ServiceProviderDiExtensions Class
Namespace: PTS
Assembly: PTS.DependencyInjection.dll
Helper extension methods for System.IServiceProvider
Syntax
public static class ServiceProviderDiExtensions
Inheritance
System.Object
ServiceProviderDiExtensions
Methods
GetParentServiceProvider<TService>(IServiceProvider, Boolean)
Fetches service defined in parent scope.
Declaration
public static TService GetParentServiceProvider<TService>(this IServiceProvider provider, bool require = true)
where TService : class
Parameters
| Type | Name | Description |
|---|---|---|
| System.IServiceProvider | provider | The provider to traverse upwards from. |
| System.Boolean | require | If set to |
Returns
| Type | Description |
|---|---|
| TService | The service from parent scope. |
Type Parameters
| Name | Description |
|---|---|
| TService | The type of the service to retrive from parent scope. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown if require parameter is set to |
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()