I would like to have two DbContexts in the same project but automatic migrations enabled only for one. Is it possible?
Asked
Active
Viewed 3,206 times
1 Answers
2
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.

Dejan
- 9,150
- 8
- 69
- 117