Skip to content

IEntityType is replaced by ITypeBase but I loose certain methods that I need for EfCore.SchemaCompare library #34594

@JonPSmith

Description

@JonPSmith

I used IEntityType to get lots of information when comparing the DbContext's Model with the database in my EfCore.SchemaCompare library. I see that IEntityType is obsolete and I changed to ITypeBase. However, the ITypeBase doesn't have certain methods that I need. They are:

  • GetForeignKeys()
  • FindPrimaryKey()
  • Model.GetIndexes()

Also the IProperty's DeclaringEntityType is obsolete and I can't find a method to tell me if an entity is Owned. The old code used property.DeclaringEntityType.IsOwned().

Include your code

The Stage1Comparer contains code to compare the DbContext's Model against the database data, provided by the EF Core's Scaffolder.

  • Table/View exists: That a table or view that an entity class is mapped exists. This checks both table/view name and schema name
  • Property/Column: exists, database type (including size and precision), nullability, computed column (including persistence), column default value, when updated (e.g. column is updated OnAdd for a int primary key which is provided by the database)
  • Primary key: SQL constraint name, properties
  • Foreign keys: SQL constraint name, Delete behavior, properties
  • Indexes: SQL constraint name, Unique/not unique, properties

Include provider and version information

EF Core version: 8.0.2
Database provider: all
Target framework: .NET 8.0
Operating system: Windows
IDE: Visual Studio 2022 17.11.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions