ServiceProviderAccessor Class
Namespace: PTS.DependencyInjection.Common
Assembly: PTS.DependencyInjection.dll
Syntax
public abstract class ServiceProviderAccessor : IServiceProviderAccessor
Implements
Constructors
ServiceProviderAccessor(IServiceProviderAccessor)
Declaration
protected ServiceProviderAccessor(IServiceProviderAccessor otherService)
Parameters
Type | Name | Description |
---|---|---|
IServiceProviderAccessor | otherService |
ServiceProviderAccessor(IServiceProvider)
Declaration
public ServiceProviderAccessor(IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
System.IServiceProvider | serviceProvider |
Properties
ServiceProvider
Gets the IserviceProvider
instance in current scope.
Declaration
public IServiceProvider ServiceProvider { get; }
Property Value
Type | Description |
---|---|
System.IServiceProvider |
Methods
GetService<TService>(Boolean)
Attempts to retrieve a service from current service provider.
Declaration
protected TService GetService<TService>(bool require = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | require | If set to |
Returns
Type | Description |
---|---|
TService | A service object of type |
Type Parameters
Name | Description |
---|---|
TService | Type of service to look up. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown if the service was not founds and require parameter was set to |
Implements
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()