Reputation: 19707
I have several tables in my DB that I do not want EntityFramework to create classes for. How can I tell EF to ignore certain tables?
I am not that familiar with configuring EF. The way we tell EF to look at our DB and create/change POCOs is by running a Nuget command line of "Scaffold-DbContext "a connection string" Microsoft.EntityFrameworkCore.SqlServer -DataAnnotations -Force -OutputDir Data"
Is there a way to tell EF to ignore specific tables?
Upvotes: 1
Views: 367
Reputation: 481
You can specify which tables to include, using the -Tables parameter to specify the tables:
Scaffold-DbContext "connection-string" MySql.Data.EntityFrameworkCore -OutputDir dir -Tables table1,table2,table3
Upvotes: 1
Reputation: 794
You can use the tables or schema switch to explicitly list which tables or schemas (include all tables within the schema) to reverse engineer.
https://learn.microsoft.com/en-us/ef/core/managing-schemas/scaffolding
Upvotes: 1