Get related data from Azure Function using SQLTrigger?

Greg Smith 15 Reputation points
2023-04-05T19:19:58.0533333+00:00

Hi, I have an Azure function that is running a SqlTrigger. When the trigger fires, we get a list of SQLChange<CourseStudent>, and CourseStudent is defined by the model below:

    public partial class CourseStudent
    {
        public string StudentId { get; set; }

        public Guid CourseId { get; set; }

        public virtual Course Course { get; set; } 

    }

Is there any way to have the foreign-key related data (Course, in this case) populate so it can be read when reading the list of CourseStudent? I'm not sure if there is any config for this, but the documentation doesn't mention anything.

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

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,431 Reputation points Moderator
    2023-04-11T17:58:12.5033333+00:00

    Greg Smith Sorry for the delay in our response. It looks like you already got the answer from our product team via https://github.com/Azure/azure-functions-sql-extension/discussions/797 discussion. Sharing it here for the benefit of the community. If you face any issues, feel free to reach out to us and thanks again for posting it in Microsoft Q&A.

    Answer from PG:

    Currently no, not directly at least. Using an input binding would be an option - although that would require either setting up another function that the one with the sql trigger calls (passing it the appropriate information from the trigger) or using imperative bindings for C# functions to dynamically call the input binding.

    0 comments No comments

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.