Inject EntityFramework DbContext in a .NET 6 Azure Function

Bernhard S 126 Reputation points
2023-01-21T13:03:51.93+00:00

Where do I have to put the DbContext in a .NET 6 Azure Function?

builder.Services.AddDbContext
Developer technologies | .NET | Entity Framework Core
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 81,981 Reputation points Volunteer Moderator
    2023-01-22T19:55:20.4733333+00:00

    you need to add the nuget package:

    Microsoft.Extensions.Logging.Abstractions

    note: it should have been added when you added:

    Microsoft.Extensions.Configuration


Your answer

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