-
Notifications
You must be signed in to change notification settings - Fork 474
Closed
Description
Is your question related to a specific version? If so, please specify:
both v2 and v3, and static and IoC
What language does your question apply to? (e.g. C#, JavaScript, Java, All)
C#
Question
I wonder whether there is a sort of hook interface like IFunctionHook or so, so that we can implement the hook to be invoked while the Functions runtime boots up. Do we have such kind? For example:
public interface IFunctionHook
{
void Run();
}
public class MyHookClass : IFunctionHook
{
public void Run()
{
// Do Something
}
}And, somewhere in the functions host runtime has...
var assembly = Assembly.GetExecutingAssembly();
var types = assembly.GetTypes()
.Where(p => p.GetInterface("IFunctionHook", ignoreCase: true) != null);
foreach (var type in types)
{
var instance = Activator.CreateInstance(type);
(instance as IFunctionHook).Run();
}While the Function rumtime boots up, it searches any class implementing IFunctionHook and invokes the Run() method like above.