メインコンテンツまでスキップ

Register Callbacks

Container Build Callbacks

You can register any arbitrary action to happen at container build time by registering a build callback.

builder.RegisterBuildCallback(container =>
{
var serviceA = container.Resolve<ServiceA>();
var serviceB = container.Resolve<ServiceB>();
// ...
});
  • We can use IObjectResolver as a callback argument.
  • For more information about IObjectResolver, see Contaienr API

Container Dispose Callback

builder.RegisterDisposeCallback(container =>
{
// Processes you want to perform in which the container is disposed.
});