DryIoc 中的 autofac .OnActivated 等价物是什么?

What is the autofac .OnActivated equivalent in DryIoc?

在从 Autofac 切换到 DryIoc 时,我需要实现类似于 OnActivated 的功能。

给出以下 class

public interface IService
{
    void DoStuff {}
}
public class SomeService : IService
{
    public void DoStuff() {}
    public void Init(){}
}

我的 autofac 注册看起来像这样

builder.RegisterType<SomeService>()
     .As<IService>()
     .OnActivated(x => x.Instance.Init())
     .SingleInstance();

在 DryIoc 中,这相当于什么?

RegisterInitializer 将是最接近的等价物,检查 docs.

但它只是非常强大的 DryIoc Decorators 之上的一颗糖。所以我建议更深入地研究它们。