0

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

Dejan
  • 9,150
  • 8
  • 69
  • 117

1 Answers1

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