0

I want my Identity data context (IdentityDbContext<IdentityUser>) and my regular EF model's data context (DbContext), to be separate.

Many say to merge them, but I don't see the point. They are very different, at least in my scenario, and I want to decouple them.

When I use initializers for each (CreateAlways, DropCreate, etc.), all works well. But I would like to use migrations for both data contexts - and I can only make it work for one, not both.

What is the secret to this?

h bob
  • 3,610
  • 3
  • 35
  • 51

2 Answers2

0

Does your to contexts reside in the same namespace? If so try to separate them into individual namespaces as suggested in this thread

Community
  • 1
  • 1
Indregaard
  • 1,195
  • 1
  • 18
  • 26
0

This is possible. It is necessary to set the parameters to the enable-migrations command, which allows more than one context per assembly, and to control each one separately.

h bob
  • 3,610
  • 3
  • 35
  • 51