Create database tables with Entity Framework Core conditionally

Viewed 21

I have an application which uses Entity Framework Core to manage a database with a list of default tables. These tables are defined as DbSets in the DatabaseContext and DatabaseContext.Database.EnsureCreated() is used to create the database and all its tables if the database does not yet exist.

From time to time we need some customer specific tables that we only want to include in this customers installation.

Is there any way to have DatabaseContext create tables conditionally, f.e. when a flag in my settings file is set?

0 Answers
Related