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