namespace Microsoft.Data.Entity.SqlServer.Design.ReverseEngineering.Model
{
    public class ForeignKeyColumnMapping
    {
        public const string Query = "SELECT\r\n    quotename(SCHEMA_NAME(fk.schema_id)) + quotename(fk.name) + quotename(SCHEMA_NAME(fromSchema.schema_id)) + quotename(OBJECT_NAME(fk.parent_object_id)) + quotename(fromCol.name) [Id]\r\n  , quotename(SCHEMA_NAME(fk.schema_id)) + quotename(fk.name) [ConstraintId]\r\n  , quotename(SCHEMA_NAME(fromSchema.schema_id)) + quotename(OBJECT_NAME(fk.parent_object_id)) + quotename(fromCol.name) [FromColumnId]\r\n  , quotename(SCHEMA_NAME(toSchema.schema_id)) + quotename(OBJECT_NAME(fk.referenced_object_id)) + quotename(toCol.name) [ToColumnId]\r\n  FROM\r\n  sys.foreign_keys fk\r\n  INNER JOIN\r\n  sys.foreign_key_columns fkc ON fkc.constraint_object_id = fk.object_id\r\n  INNER JOIN\r\n  sys.columns toCol ON fkc.referenced_column_id = toCol.column_id AND fkc.referenced_object_id = toCol.object_id /* PRIMARY KEY COLS*/\r\n  INNER JOIN\r\n  sys.columns fromCol ON fkc.parent_column_id = fromCol.column_id AND fkc.parent_object_id = fromCol.object_id /* FOREIGN KEY COLS*/\r\n  INNER JOIN\r\n  sys.objects toSchema ON toSchema.object_id = fk.referenced_object_id\r\n  INNER JOIN\r\n  sys.objects fromSchema ON fromSchema.object_id = fk.parent_object_id\r\n";
    }
}
Assembly EntityFramework.SqlServer.Design , Version=7.0.0.0, PublicKeyToken=
Package EntityFramework.SqlServer.Design net45
.NET Framework 4.54.5.14.5.24.64.6.14.6.24.74.7.14.7.24.8

10/24/2021
An error has occurred. This application may no longer respond until reloaded. Reload 🗙