/// <summary> /// <para> /// Creates the service dependencies parameter object for a <see cref="MigrationsScaffolder" />. /// </para> /// <para> /// Do not call this constructor directly from either provider or application code as it may change /// as new dependencies are added. Instead, use this type in your constructor so that an instance /// will be created and injected automatically by the dependency injection container. To create /// an instance with some dependent services replaced, first resolve the object from the dependency /// injection container, then replace selected services using the 'With...' methods. Do not call /// the constructor at any point in this process. /// </para> /// <para> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </para> /// </summary> /// <param name="currentDbContext"> The current DbContext. </param> /// <param name="model"> The model. </param> /// <param name="migrationsAssembly"> The migrations assembly. </param> /// <param name="migrationsModelDiffer"> The migrations model differ. </param> /// <param name="migrationsIdGenerator"> The migrations ID generator. </param> /// <param name="migrationCodeGenerator"> The migrations code generator. </param> /// <param name="historyRepository"> The history repository. </param> /// <param name="operationReporter"> The operation reporter. </param> /// <param name="databaseProvider"> The database provider. </param> /// <param name="snapshotModelProcessor"> The snapshot model processor. </param> public MigrationsScaffolderDependencies( [NotNull] ICurrentDbContext currentDbContext, [NotNull] IModel model, [NotNull] IMigrationsAssembly migrationsAssembly, [NotNull] IMigrationsModelDiffer migrationsModelDiffer, [NotNull] IMigrationsIdGenerator migrationsIdGenerator, [NotNull] IMigrationsCodeGenerator migrationCodeGenerator, [NotNull] IHistoryRepository historyRepository, [NotNull] IOperationReporter operationReporter, [NotNull] IDatabaseProvider databaseProvider, [NotNull] ISnapshotModelProcessor snapshotModelProcessor) { Check.NotNull(currentDbContext, nameof(currentDbContext)); Check.NotNull(model, nameof(model)); Check.NotNull(migrationsAssembly, nameof(migrationsAssembly)); Check.NotNull(migrationsModelDiffer, nameof(migrationsModelDiffer)); Check.NotNull(migrationsIdGenerator, nameof(migrationsIdGenerator)); Check.NotNull(migrationCodeGenerator, nameof(migrationCodeGenerator)); Check.NotNull(historyRepository, nameof(historyRepository)); Check.NotNull(operationReporter, nameof(operationReporter)); Check.NotNull(databaseProvider, nameof(databaseProvider)); Check.NotNull(snapshotModelProcessor, nameof(snapshotModelProcessor)); CurrentDbContext = currentDbContext; Model = model; MigrationsAssembly = migrationsAssembly; MigrationsModelDiffer = migrationsModelDiffer; MigrationsIdGenerator = migrationsIdGenerator; MigrationCodeGenerator = migrationCodeGenerator; HistoryRepository = historyRepository; OperationReporter = operationReporter; DatabaseProvider = databaseProvider; SnapshotModelProcessor = snapshotModelProcessor; }
public MigrationsScaffolderDependencies With([NotNull] IMigrationsCodeGenerator migrationCodeGenerator) { if (MigrationsCodeGeneratorSelector is MigrationsCodeGeneratorSelector overridableSelector) { overridableSelector.Override = migrationCodeGenerator; } return(this); }
/// <summary> /// Clones this dependency parameter object with one service replaced. /// </summary> /// <param name="migrationCodeGenerator"> A replacement for the current dependency of this type. </param> /// <returns> A new parameter object with the given service replaced. </returns> public MigrationsScaffolderDependencies With([NotNull] IMigrationsCodeGenerator migrationCodeGenerator) => new MigrationsScaffolderDependencies( CurrentDbContext, Model, MigrationsAssembly, MigrationsModelDiffer, MigrationsIdGenerator, migrationCodeGenerator, HistoryRepository, OperationReporter, DatabaseProvider, SnapshotModelProcessor);
public MigrationsScaffolderDependencies With([NotNull] IMigrationsCodeGenerator migrationCodeGenerator) { MigrationCodeGeneratorSelector.Override = migrationCodeGenerator; return(this); }