I have a class library with methods that I want to map and execute as Azure Functions.

How those methods should get mapped up (e.g. as timer, http trigger, what http verb or route to use, etc.) for our use case is not known at design/compile time, but at run time.

This is at odds with the prescribed way of making a function class and decorating it with Azure Function attributes. We can't declare the attributes, since that information isn't available to us at compile time.

How can I declare/define/bind azure functions against my class library's methods at run time (such as when the function app starts)?

I have noticed that if you create new function.json files/folders the runtime will restart the app to pick up the changes. I attempted to just write out a new function.json pointing to the desired code, but when I try to access the endpoint, it fails with the (very true) complaint that my class method is not decorated with attributes. Because I can't, as above.

I would prefer a solution that works with Azure Functions V1 and V2

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.