I'm trying out Code First. I've two seperate contexts using the same database.
My problem is how to use the databaseinitializers.
If I use a initializer that drops the database, it only works for the first context. Then I initialize the secont context, and that initializer delets the tables creatde by the first initializer.
Any advices who to solve this?
In case of code first you should not have two different context types for the same database. You should have only one - your use case is not expected in code first scenario.
To solve your problem you must simply use initializer only for one context type and make sure that it is always used first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With