public void Scaffold_migration() { using (var context = new Context(CreateModel())) { var scaffolder = new MyMigrationScaffolder( context.Configuration, MockMigrationAssembly(context.Configuration), new ModelDiffer(new DatabaseBuilder()), new CSharpMigrationCodeGenerator( new CSharpModelCodeGenerator()), ValidateMigration, ValidateModelSnapshot); scaffolder.ScaffoldMigration("MyMigration"); } }
public void Scaffold_migration_with_composite_keys() { using (var context = new Context(CreateModelWithCompositeKeys())) { var scaffolder = new MyMigrationScaffolder( context.Configuration, MockMigrationAssembly(context.Configuration), new TestModelDiffer(), new CSharpMigrationCodeGenerator( new CSharpModelCodeGenerator()), ValidateMigrationWithCompositeKeys, ValidateModelWithCompositeKeysSnapshot); scaffolder.ScaffoldMigration("MyMigration"); } }
public void Scaffold_migration_with_foreign_keys() { using (var context = new Context(CreateModelWithForeignKeys())) { var scaffolder = new MyMigrationScaffolder( context.Configuration, MockMigrationAssembly(context.Configuration), new ModelDiffer(new DatabaseBuilder()), new CSharpMigrationCodeGenerator( new CSharpModelCodeGenerator()), ValidateMigrationWithForeignKeys, ValidateModelWithForeignKeysSnapshot); scaffolder.ScaffoldMigration("MyMigration"); } }
public void Scaffold_empty_migration() { using (var context = new Context(new Model())) { var scaffolder = new MyMigrationScaffolder( context.Configuration, MockMigrationAssembly(context.Configuration), new ModelDiffer(new DatabaseBuilder()), new CSharpMigrationCodeGenerator( new CSharpModelCodeGenerator()), ValidateEmptyMigration, ValidateEmptyModelSnapshot); scaffolder.ScaffoldMigration("MyMigration"); } }
public void Scaffold_migration_with_composite_keys() { using (var context = new Context(CreateModelWithCompositeKeys())) { var contextServices = ((IDbContextServices)context).ScopedServiceProvider; var options = contextServices.GetRequiredService <DbContextService <IDbContextOptions> >(); var model = contextServices.GetRequiredService <DbContextService <IModel> >().Service; var scaffolder = new MyMigrationScaffolder( context, options.Service, model, new MigrationAssembly(new DbContextService <DbContext>(context), options), CreateModelDiffer(), new CSharpMigrationCodeGenerator( new CSharpModelCodeGenerator()), ValidateMigrationWithCompositeKeys, ValidateModelWithCompositeKeysSnapshot); scaffolder.ScaffoldMigration("MyMigration", "MyNamespace"); } }