Skip to content

EfSchemaCompare limitations

Jon P Smith edited this page Jan 26, 2021 · 6 revisions

There are a few limitations on what the EfSchemaCompare feature can check.

Checks that the system can't do

  1. Because I use EF Core's scaffolder I cannot check if an index is applied to a foreign key (the scaffolder assumes EF Core will do that by default). EF Core adds indexes to foreign keys.

Checks that don't always work properly

  1. There is a bug in the EF Core 3 version around the nullability of properties in Owned Types.
  2. There are some limitations around setting default values (EF Core fluent command .HasDefaultValue("...")).
    • The format of string, DataTime, Enums, and bool in the database are different to the C# version, and for some the format also changes between database servers. You might want to suppress this test using AddIgnoreCompareLog - see this example of how to tell EfSchemaCompare to ignore Default values.
    • If you set a default value that is the default for that class, then EF Core doesn't report that which results in ValueGenerated errors.
  3. The format of a computed column (EF Core fluent command .HasComputedColumnSql("...")) may differ to your original, e.g. it will have extra brackets. You can normally fix that by changing your C# side string to be the same as the one in the database.

Checks that my software doesn't currently do

  1. I don't check Views or keyless entity classes
  2. I don't check Alternative keys.
  3. I have not included code to find/check sequences.
Clone this wiki locally