Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hypodermic - OnActivating

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?

like image 238
João Avatar asked Sep 19 '12 16:09

João


1 Answers

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.

like image 156
mister why Avatar answered Oct 29 '22 00:10

mister why