Skip to content

Unused tables or views #38

@randyshoopman

Description

@randyshoopman

Hi,

From the documentation I was under the impression that CompareEfWithDb would also return errors for tables and views in your database that have no mapping in the DbContext.

Stage 2 - checks on database
**Unused tables or views**
Unused columns
Unused Indexes

...
Set TablesToIgnoreCommaDelimited to "" (i.e. empty string)
This will check all the tables/Views in the database

We have many tables and views in our database that do not have corresponding EF entities in our DbContext but I'm not seeing any errors about those. Here is my test code:

using var context = new MyXDbContext(builder.Options);

var config = new CompareEfSqlConfig() { TablesToIgnoreCommaDelimited = "" };

var comparer = new CompareEfSql(config);
var hasErrors = comparer.CompareEfWithDb(context);

What am I doing wrong or is my understanding of Stage 2 not correct? Thanks!

As background we are converting an app from EF6 with an edmx to EFCore. Eventually we'd like to consider going code first so I'm using this as a way to preview what migrations might do to our current db schema.

As for the entities that do map to database tables this has been a great tool to identify and clean up ef6 migration issues (nullability, default values, etc) with our EF core entities . Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions