7
votes

I want to run code when the Azure Function's hub is starting and to be sure that's executed before any Azure function can be called in that hub. Can I do that?

1
What's Hub? Instance/server? - Mikhail Shilkov
Yes, instance. When the instance (the proccess) is starting... i want to run custom code, before any azure function can be executed. - gabomgp

1 Answers

8
votes

Given your are using precompiled C# functions, you could put your initialization code into static constructor:

public static class MyFunctionApp
{
    static MyFunctionApp()
    {
        // Runs once when class is first loaded
    }

    public void Run([SomeTrigger] input)
    {
        // Runs on each event
    }
}