# SimpleServiceProvider class

A minimal IServiceProvider implementation with no dependency on any DI container. Intended for applications and tests that do not need a full container. Applications with a container register the services their own way, see [`RegisterApplicationServices`](./ApplicationServicesContext/RegisterApplicationServices.md).

```csharp
public sealed class SimpleServiceProvider : IDisposable, IServiceProvider
```

## Public Members

| name | description |
| --- | --- |
| [SimpleServiceProvider](SimpleServiceProvider/SimpleServiceProvider.md)() | The default constructor. |
| [AddSingleton](SimpleServiceProvider/AddSingleton.md)(…) | Registers a service factory. The instance is created on first request. The signature is compatible with [`RegisterApplicationServices`](./ApplicationServicesContext/RegisterApplicationServices.md): `ApplicationServicesContext.RegisterApplicationServices(provider.AddSingleton);` |
| [AddSingleton&lt;TService&gt;](SimpleServiceProvider/AddSingleton.md)(…) | Registers a ready instance under the *TService* type. The type is stated explicitly so a service cannot be accidentally registered under its concrete class instead of its interface. |
| [Dispose](SimpleServiceProvider/Dispose.md)() | Disposes the created services that implement IDisposable. |
| [GetService](SimpleServiceProvider/GetService.md)(…) |  |

## Remarks

All services are created lazily and live as singletons. Created instances implementing IDisposable are disposed by [`Dispose`](./SimpleServiceProvider/Dispose.md).

## See Also

* namespace [Eremex.AvaloniaUI.Controls.ApplicationServices](./index.md)

<!-- DO NOT EDIT: generated by xmldocmd for Eremex.Avalonia.Controls.ApplicationServices.dll -->
