I have been given a project that uses Durable Functions to run a few sequential logic steps with some triggers for timers/http etc.
Problem is there is sooooo much boilerplate code here, there is about 150 lines in each Azure function and about 120 lines of that are virtually identical between function classes. This means when a new one is added the developer has to know to copy the same conventions and setup triggers etc which is tiresome and makes things hard to read/maintain.
If this wasn't using Azure Functions and was just daisy chained awaited functions with some orchestration logic I would normally expect an interface or abstract class of some kinda to enforce the convention so a new addition would be inherited/implemented and you implement the bits that are unique to your instance following the convention.
ANYWAY as it is all using Azure Functions the only documentation I can find for setting up Functions/Triggers is using attributes, but they require compile time values to be passed in as well as some other constraints, but I was wondering if there is any escape hatch for people to do something like
appBuilder.RegisterFunction(nameof(SomeFunctionSomewhere),
x => x.WithHttpTrigger(AuthorizationLevel.Anonymous, "GET"))
The main issue I am facing is if I were to move to an abstract class approach to wrap up the conventions, trying to name the functions wouldn't work as they would all end up with same name as the attribute cannot take any polymorphic data into the names etc (from what I can tell).
If you can't do this no problem but wanted to ask
[Function(nameof(MyFunction))] public Task MyFunction([ActivityTrigger] string someData)every inherited class would cause thatMyFunctionto get registered right? so it would throw issues? if you have a way around this can you post it as an answer with an example?