- To alter ModelBuilder outside DbContext, implement
IModelCustomizer
/ inherit fromModelCustomizer
and replace inIServiceCollection
afterAddEntityFramework()
- To change when DbContext rebuilds model, implement 'IModelCacheKeyFactory' / inherit from
ModelCacheKeyFactory
and generate a different key when model changes, and replace it inIServiceCollection
. - No more magic with DbContext creation