IPackage Interface

Simple Injector
Contract for types allow registering a set of services.

Namespace:  SimpleInjector.Packaging
Assembly:  SimpleInjector.Packaging (in SimpleInjector.Packaging.dll) Version: 4.10.2
Syntax

public interface IPackage

The IPackage type exposes the following members.

Methods

  NameDescription
Public methodRegisterServices
Registers the set of services in the specified container.
Top
Examples

The following example shows an implementation of an IPackage.
C#
public class BusinessLayerPackage : IPackage
{
    public void RegisterServices(Container container)
    {
        container.Register<IUserRepository, DatabaseUserRepository>();
        container.Register<ICustomerRepository, DatabaseCustomerRepository>();
    }
}
The following example shows how to load all defined packages, using the RegisterPackages method.
C#
container.RegisterPackages();
See Also

Reference