Dejan
Dejan

Reputation: 10363

Is it possible to have automatic migrations for one DbContext and not for another in the same project?

I would like to have two DbContexts in the same project but automatic migrations enabled only for one. Is it possible?

Upvotes: 1

Views: 3343

Answers (1)

Dejan
Dejan

Reputation: 10363

It is. Each DbMigrationsConfiguration is bound to one specific DbContext via ContextKey. As soon as you have more than on DbContext, the Enable-Migrations command requires the -ContextTypeName parameter. One can easily just run Enable-Migrations for one DbContext and omit it for the other.

Upvotes: 3

Related Questions