Inject EntityFramework DbContext in a .NET 6 Azure Function

Bernhard 111 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
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
741 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,990 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,119 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 65,211 Reputation points
    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 Answers by the question author, which helps users to know the answer solved the author's problem.