Skip to content

Ability to exclude/skip/ignore parts of the model from migrations so that a table is not created (for overlapping bounded contexts) #2725

@brent-russell

Description

@brent-russell

I suggest having an attribute that can be applied to DbSet properties in a DbContext, which indicates whether or not to include them in the migration scaffolding process.

An example use case is when part of an application's database is replicated from another environment. Replicated entities will be included in the same DbContext as custom-developed entities so they can be queried. During development many migrations may be performed. Each time a migration is scaffolded, the replicated entities will be added to the migration, and then must be removed manually.

If an attribute only used for EF commands is too polluting to include in the DbContext, some alternatives might be: an additional config file that can be specified on the command line listing which entities should be excluded. Or perhaps additional command line arguments that allow a migration to be generated for specified entities only instead of scanning and comparing all entities.

Also consider the scenario of inherited models when looking at this feature #5572

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions