silentgut
silentgut

Reputation: 87

How to Scaffold DbContext but ignore tables in database

How can I use Scaffold DbContext without including tables? Our database has a lot of tables which I don't need - I only need to call a couple of stored procedures.

I'm using a .NET Core console application with Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Tools and Microsoft.EntityFrameworkCore.SqlServer.Design as my packages.

I tried to check Entity Framework Core tools reference but you have to reference at least one table using -t/--table

Upvotes: 1

Views: 3739

Answers (1)

Banshee
Banshee

Reputation: 15847

If the table is not to complex or it is not updated often, then just skip Scaffold and build the DBContext and Table class manually, don't forget to decorate with key if needed.

An alternative to this is using EF Core Powertools.

Upvotes: 1

Related Questions