Docs Azure SQL output binding for Azure Functions query

Sebastian Januschewski 20 Reputation points
2025-06-20T12:17:32.6366667+00:00

Can you verify if code in this documentation is correct?

https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-azure-sql-output?tabs=isolated-process%2Cnodejs-v4%2Cpython-v2&pivots=programming-language-csharp#http-trigger-write-one-record-c-oop

We have a static class named OutputType which have non static members. Additionally its instance is being created by using new keyword. Am I missing something?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
{count} votes

Accepted answer
  1. Ranashekar Guda 2,670 Reputation points Microsoft External Staff Moderator
    2025-06-20T17:47:20.6633333+00:00

    Hello @Sebastian Januschewski,

    In C#, a static class cannot contain instance members, and you cannot create instances of a static class using the new keyword. So, if the OutputType class in the documentation is defined as static but includes non-static members or is instantiated that would be incorrect.

    Here's the correct approach:

    • If you want to create an instance of OutputType (e.g., using new OutputType()), then it must not be declared static.
    • If you intend to keep OutputType static, then all its members must also be static, and it should not be instantiated.

    Output bindings like [SqlOutput] require properly structured types, whether static or non-static, depending on how the function is written. Also, HttpResponseData is typically constructed and returned from the function method itself.

    To ensure your function runs correctly, please:

    • Review your class definition to match C# static class rules.
    • Check for any runtime errors when running the function.
    • Review your function.json or attribute decorations if you're using attribute-based bindings.

    Hope this helps. Do let us know if you any further queries.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.