I have a Visual Studio Azure Function project with number of functions. Most of them need logic calculating some value based on Azure Storage Table entity.
I can easily make input binding to that entity in each Azure Function:
[FunctionName("Function1")]
public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, [Table("Table", "SomeValue", "SomeOtherValue")] MyPoco poco, ILogger log)
{
// some logic based on poco object
}
However this creates redundancy as each function must contain the same logic and table binding. I have created a static method for that logic, but input binding does not work there.
public static int DoTheLogic([Table("Table", "SomeValue", "SomeOtherValue")] MyPoco poco)
{
// some logic based on poco object
// and return int value to calling Azure Function
}
- Can input binding be done only in functions being Azure Functions?
- How can I reference to Azure Table in
DoTheLogicfunction if the first one is true. - Same, could
ILogger logbe used byDoTheLogicfunction?
The only solution I can see is passing poco and log from each Azure Function to DoTheLogic but that does not look good.