Azure / Azure/azure-functions-host
EfCore and Azure Functions: *Context violates constraint of TContext
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
#### Repro steps
Repro Application: https://github.com/ry8806/AzureFunctionsBug1
Just F5 Run and wait (<30 secs) for the Timer to fire
#### Expected behavior
The ApplicationDbContext is retrieved from DI and able to be accessed by subsequent code.
#### Actual behavior
The application fails with an exception about how the *Context violates the constraint of TContext, when using the service provider. This setup of DI works fine in ASP.NET Core MVC App, but fails in this instance. Looks like it is due to ASP.NET Core Identity being inherited by the main "ApplicationDbContext"
#### Known workarounds
None
Contributor guide
Research direction
Start by running the linked AzureFunctionsBug1 reproduction and wait for the timer-triggered failure described in the issue. Then trace the dependency-injection service-provider path and the ApplicationDbContext setup; done means identifying a reproducible host-side fix or a documented limitation, with the original reproduction no longer throwing the TContext constraint exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100