/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> /// <param name="migrationClass"></param> /// <param name="activeProvider"></param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">activeProvider</exception> public override Migration CreateMigration(TypeInfo migrationClass, string activeProvider) { if (activeProvider == null) { throw new ArgumentNullException(nameof(activeProvider)); } var serviceProvider = _dbContext.GetInfrastructure(); var migration = ( Migration )ActivatorUtilities.CreateInstance(serviceProvider, migrationClass.AsType()); migration.ActiveProvider = activeProvider; if (migration is EntityMigration entityMigration) { entityMigration.ServiceProvider = serviceProvider; } return(migration); }