Martin Gemme
Martin Gemme

Reputation: 345

Azure Function with EntityFramework + DI

It seems that Microsoft.NET.Sdk.Functions version 3.0.4 broke DI with EntityFrameworkCore.

With 3.0.3, I can add an InMemoryDatabase in the DI and use it in my Function, but upgrading to 3.0.4 breaks stating:

Microsoft.Extensions.DependencyInjection.Abstractions: Unable to resolve service for type 'AzureFunction.Contexts.TestContext' while attempting to activate 'AzureFunction.TestFunction'.

I made the repro project available with picture (see images/) here

Upvotes: 1

Views: 130

Answers (1)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 29940

Yes, it's an issue in Microsoft.NET.Sdk.Functions version 3.0.4.

You can try it on the 3.0.5 which is released a few hours ago and DI issue is fixed.

Upvotes: 1

Related Questions