JonPSmith / EfCore.SchemaCompare

Library to compare EF Core's Model of the database against a database's schema.
https://www.thereformedprogrammer.net/how-to-update-a-databases-schema-without-using-ef-cores-migrate-feature/
MIT License
106 stars 15 forks source link

Documentation not clear how to use CompareLog to add exclusion for property on specific entity. #16

Closed pm7y closed 1 year ago

pm7y commented 1 year ago

Please can you describe how to programmatically add an exclusion for a property of a specific entity.

Could it be something like this? using SubLogs?

        var userCompareLog = new CompareLog(CompareType.Entity, CompareState.Different, nameof(User), CompareAttributes.TableName);
        userCompareLog.SubLogs.Add(new CompareLog(CompareType.Property, CompareState.Different, nameof(User.FullName), CompareAttributes.DefaultValueSql, expected: null, found: "''"));
JonPSmith commented 1 year ago

The Suppress errors via AddIgnoreCompareLog explains how to suppress a general set of errors. That means it any CompareLog that matches. That means you can't match to a CompareLog and its SubLog.