9

I've been recently trying to use https://github.com/ybainier/Hypodermic for dependency injection on C++. Yet, I am unable to find if it supports the OnActivating event from AutoFac:

builder.RegisterInstance(instance).OnActivating(MyLambdaHere)

Is there any way on Hypodermic to mimic this functionality?

mister why
  • 1,967
  • 11
  • 33
João
  • 113
  • 4

1 Answers1

9

This feature comes with the new release (0.1.2). You can use it like so:

builder.registerInstance(instance)->onActivating(
    [](IActivatingData< MyStaticInstanceType >& data) -> void
    {
        // Your "Activating" code here
    }
);

Besides, IRegistrationBuilder exposes onPreparing() and onActivated() as well. I hope that helps.

mister why
  • 1,967
  • 11
  • 33