-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/persisted-computed-column
- Loading branch information
Showing
7 changed files
with
95 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace SchemaZen.Library.Models.Comparers | ||
{ | ||
public class ForeignKeyComparer : IComparer<ForeignKey> | ||
{ | ||
public static ForeignKeyComparer Instance { get; } = new ForeignKeyComparer(); | ||
|
||
public int Compare(ForeignKey x, ForeignKey y) | ||
{ | ||
var result = string.Compare(x.Table.Owner, y.Table.Owner, StringComparison.Ordinal); | ||
|
||
if (result != 0) | ||
{ | ||
return result; | ||
} | ||
|
||
result = string.Compare(x.Table.Name, y.Table.Name, StringComparison.Ordinal); | ||
|
||
if (result != 0) | ||
{ | ||
return result; | ||
} | ||
|
||
result = x.Columns.Count.CompareTo(y.Columns.Count); | ||
|
||
if (result != 0) | ||
{ | ||
return result; | ||
} | ||
|
||
for (var i = 0; i < x.Columns.Count; i++) | ||
{ | ||
result = string.Compare(x.Columns[i], y.Columns[i], StringComparison.Ordinal); | ||
if (result != 0) | ||
{ | ||
return result; | ||
} | ||
} | ||
|
||
result = x.RefColumns.Count.CompareTo(y.RefColumns.Count); | ||
|
||
if (result != 0) | ||
{ | ||
return result; | ||
} | ||
|
||
for (var i = 0; i < x.RefColumns.Count; i++) | ||
{ | ||
result = string.Compare(x.RefColumns[i], y.RefColumns[i], StringComparison.Ordinal); | ||
if (result != 0) | ||
{ | ||
return result; | ||
} | ||
} | ||
|
||
return string.Compare(x.Name, y.Name, StringComparison.Ordinal); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters