Skip to content
Documentation

IApplicationContext Interface

Used to configure a dependency injection container and activate a registered service to act as the root of an application.

public interface IApplicationContext

IApplicationContext.Create(Action<IContainer>) Method

Section titled “IApplicationContext.Create(Action<IContainer>) Method”

Creates an application context using the default container.

var app = IApplicationContext.Create((container)=>{
container
.Use<ISomeService,ISomeImplementation>();
.Use<ISomeOtherService,ISomeOtherImplementation>();
});
var myApp = app.Start<ISomeService>();
static HAKOM.DependencyInjection.Core.Net.Api.IApplicationContext Create(System.Action<HAKOM.DependencyInjection.Core.Net.Api.IContainer> containerConfigurator);

containerConfigurator System.Action<IContainer>

Register any dependencies within this action.

IApplicationContext
The IApplicationContext that can be used to activate any registered type.

IApplicationContext.Create<TContainer>(Action<TContainer>) Method

Section titled “IApplicationContext.Create<TContainer>(Action<TContainer>) Method”

Creates an application context based on the given container type. Allows configuration of the container using the given action.

static HAKOM.DependencyInjection.Core.Net.Api.IApplicationContext Create<TContainer>(System.Action<TContainer> containerConfigurator)
where TContainer : class, HAKOM.DependencyInjection.Core.Net.Api.IContainer, new();

TContainer

The type of container to use.

containerConfigurator System.Action<TContainer>

Register any dependencies within this action.

IApplicationContext
The IApplicationContext that can be used to wire up any registered class.

IApplicationContext.Create<TContainer>(TContainer) Method

Section titled “IApplicationContext.Create<TContainer>(TContainer) Method”

Creates an application context based on the given container.

var container = new AutoFacContainer(); //must implement IContainer
container
.Use<ISomeService,ISomeImplementation>();
.Use<ISomeOtherService,ISomeOtherImplementation>();
var app = IApplicationContext.Create(container);
var myApp = app.Start<ISomeService>();
static HAKOM.DependencyInjection.Core.Net.Api.IApplicationContext Create<TContainer>(TContainer container)
where TContainer : class, HAKOM.DependencyInjection.Core.Net.Api.IContainer;

TContainer

The type of container to use.

container TContainer

The container to use.

IApplicationContext
The IApplicationContext that can be used to activate any registered type.

Tries to instantiate the given type based on all types registered with the app context’s DI container.

TRoot Start<TRoot>()
where TRoot : notnull;

TRoot

The type to instantiate.

TRoot
The instance of the requested type as resolved by the underlying container.

IApplicationContext.Start<TRoot>(TRoot) Method

Section titled “IApplicationContext.Start<TRoot>(TRoot) Method”

Tries to instantiate the given type based on all types registered with the app context’s DI container.

System.IDisposable Start<TRoot>(out TRoot root)
where TRoot : notnull;

TRoot

The type to instantiate.

root TRoot

The instance of the requested type as resolved by the underlying container.

System.IDisposable
An System.IDisposable that can be used to dispose of the context along with its DI container.

© 2026 Volue.Version v0.6.38017 November 2026