In switching over from Autofac to DryIoc, I have a need to implement something akin to OnActivated.
Given the following class
public interface IService
{
void DoStuff {}
}
public class SomeService : IService
{
public void DoStuff() {}
public void Init(){}
}
My autofac registration would look like this
builder.RegisterType<SomeService>()
.As<IService>()
.OnActivated(x => x.Instance.Init())
.SingleInstance();
What would the equivalent of this look like in DryIoc?
RegisterInitializer
will be the closest equivalent, check the docs.
But it is just a sugar on top of very powerful DryIoc Decorators. So I suggest to look more deeply into them.