Class ServiceProvider
The default IServiceProvider.
Inherited Members
Namespace: Unity.AppUI.MVVM
Assembly: Unity.AppUI.MVVM.dll
Syntax
public sealed class ServiceProvider : IServiceProvider, IDisposable
Constructors
ServiceProvider(IServiceCollection)
Create a new ServiceProvider.
Declaration
public ServiceProvider(IServiceCollection serviceCollection)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | serviceCollection | The service collection to use. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the service collection is null. |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
GetService(Type)
Get a service from the service provider.
Declaration
public object GetService(Type serviceType)
Parameters
Type | Name | Description |
---|---|---|
Type | serviceType | The type of the service to get. |
Returns
Type | Description |
---|---|
object | The service instance. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when the requested service is not registered. |