Skip to content

Static "EntityFrameworkManager.ContextFactory" is an issue for multi-context apps #624

@gordon-matt

Description

@gordon-matt

I was playing with the Extensions recently and noticed this error:

"A default DbContext context must exist, or a context factory must be provided"

I found out that I need to setup a context factory like so:

EntityFrameworkManager.ContextFactory = context => new ApplicationDbContext();

This is all well and good if the app only has one context.. but we have multiple databases, so there's multiple contexts. So you can see that EntityFrameworkManager.ContextFactory being static is a problem.

Is there a solution to this?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions