private static void PopulateConstraints(ColumnInfo[] allColumns, ConstraintInfo[] allConstraints) { foreach (var c in allConstraints) { var column = allColumns.FirstOrDefault(p => p.Schema == c.Schema && p.TableName == c.TableName && c.ColumnName == p.ColumnName); if (column != null) { switch (c.Type) { case ConstraintType.PrimaryKey: column.IsPrimaryKey = true; break; case ConstraintType.Uniqule: column.IsUniqule = true; break; case ConstraintType.Check: column.IsCheck = true; break; } } } }