Skip to content

Commit 6012e3e

Browse files
committed
Introduce IReadOnlyIndex.DisplayName
1 parent 8360e9e commit 6012e3e

File tree

12 files changed

+85
-68
lines changed

12 files changed

+85
-68
lines changed

src/EFCore.Relational/Metadata/Internal/RelationalIndexExtensions.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public static bool AreCompatible(
3232
{
3333
throw new InvalidOperationException(
3434
RelationalStrings.DuplicateIndexTableMismatch(
35-
index.Properties.Format(),
35+
index.DisplayName(),
3636
index.DeclaringEntityType.DisplayName(),
37-
duplicateIndex.Properties.Format(),
37+
duplicateIndex.DisplayName(),
3838
duplicateIndex.DeclaringEntityType.DisplayName(),
3939
index.GetDatabaseName(storeObject),
4040
index.DeclaringEntityType.GetSchemaQualifiedTableName(),
@@ -50,9 +50,9 @@ public static bool AreCompatible(
5050
{
5151
throw new InvalidOperationException(
5252
RelationalStrings.DuplicateIndexColumnMismatch(
53-
index.Properties.Format(),
53+
index.DisplayName(),
5454
index.DeclaringEntityType.DisplayName(),
55-
duplicateIndex.Properties.Format(),
55+
duplicateIndex.DisplayName(),
5656
duplicateIndex.DeclaringEntityType.DisplayName(),
5757
index.DeclaringEntityType.GetSchemaQualifiedTableName(),
5858
index.GetDatabaseName(storeObject),
@@ -69,9 +69,9 @@ public static bool AreCompatible(
6969
{
7070
throw new InvalidOperationException(
7171
RelationalStrings.DuplicateIndexUniquenessMismatch(
72-
index.Properties.Format(),
72+
index.DisplayName(),
7373
index.DeclaringEntityType.DisplayName(),
74-
duplicateIndex.Properties.Format(),
74+
duplicateIndex.DisplayName(),
7575
duplicateIndex.DeclaringEntityType.DisplayName(),
7676
index.DeclaringEntityType.GetSchemaQualifiedTableName(),
7777
index.GetDatabaseName(storeObject)));
@@ -89,9 +89,9 @@ public static bool AreCompatible(
8989
{
9090
throw new InvalidOperationException(
9191
RelationalStrings.DuplicateIndexSortOrdersMismatch(
92-
index.Properties.Format(),
92+
index.DisplayName(),
9393
index.DeclaringEntityType.DisplayName(),
94-
duplicateIndex.Properties.Format(),
94+
duplicateIndex.DisplayName(),
9595
duplicateIndex.DeclaringEntityType.DisplayName(),
9696
index.DeclaringEntityType.GetSchemaQualifiedTableName(),
9797
index.GetDatabaseName(storeObject)));
@@ -106,9 +106,9 @@ public static bool AreCompatible(
106106
{
107107
throw new InvalidOperationException(
108108
RelationalStrings.DuplicateIndexFiltersMismatch(
109-
index.Properties.Format(),
109+
index.DisplayName(),
110110
index.DeclaringEntityType.DisplayName(),
111-
duplicateIndex.Properties.Format(),
111+
duplicateIndex.DisplayName(),
112112
duplicateIndex.DeclaringEntityType.DisplayName(),
113113
index.DeclaringEntityType.GetSchemaQualifiedTableName(),
114114
index.GetDatabaseName(storeObject),

src/EFCore.Relational/Properties/RelationalStrings.Designer.cs

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/EFCore.Relational/Properties/RelationalStrings.resx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,19 +293,19 @@
293293
<value>The foreign keys {foreignKeyProperties1} on '{entityType1}' and {foreignKeyProperties2} on '{entityType2}' are both mapped to '{table}.{foreignKeyName}', but with different uniqueness configurations.</value>
294294
</data>
295295
<data name="DuplicateIndexColumnMismatch" xml:space="preserve">
296-
<value>The indexes {indexProperties1} on '{entityType1}' and {indexProperties2} on '{entityType2}' are both mapped to '{table}.{indexName}', but with different columns ({columnNames1} and {columnNames2}).</value>
296+
<value>The indexes {index1} on '{entityType1}' and {index2} on '{entityType2}' are both mapped to '{table}.{indexName}', but with different columns ({columnNames1} and {columnNames2}).</value>
297297
</data>
298298
<data name="DuplicateIndexFiltersMismatch" xml:space="preserve">
299-
<value>The indexes {indexProperties1} on '{entityType1}' and {indexProperties2} on '{entityType2}' are both mapped to '{table}.{indexName}', but with different filters ('{filter1}' and '{filter2}').</value>
299+
<value>The indexes {index1} on '{entityType1}' and {index2} on '{entityType2}' are both mapped to '{table}.{indexName}', but with different filters ('{filter1}' and '{filter2}').</value>
300300
</data>
301301
<data name="DuplicateIndexSortOrdersMismatch" xml:space="preserve">
302-
<value>The indexes {indexProperties1} on '{entityType1}' and {indexProperties2} on '{entityType2}' are both mapped to '{table}.{indexName}', but with different sort orders.</value>
302+
<value>The indexes {index1} on '{entityType1}' and {index2} on '{entityType2}' are both mapped to '{table}.{indexName}', but with different sort orders.</value>
303303
</data>
304304
<data name="DuplicateIndexTableMismatch" xml:space="preserve">
305-
<value>The indexes {indexProperties1} on '{entityType1}' and {indexProperties2} on '{entityType2}' are both mapped to '{indexName}', but are declared on different tables ('{table1}' and '{table2}').</value>
305+
<value>The indexes {index1} on '{entityType1}' and {index2} on '{entityType2}' are both mapped to '{indexName}', but are declared on different tables ('{table1}' and '{table2}').</value>
306306
</data>
307307
<data name="DuplicateIndexUniquenessMismatch" xml:space="preserve">
308-
<value>The indexes {indexProperties1} on '{entityType1}' and {indexProperties2} on '{entityType2}' are both mapped to '{table}.{indexName}', but with different uniqueness configurations.</value>
308+
<value>The indexes {index1} on '{entityType1}' and {index2} on '{entityType2}' are both mapped to '{table}.{indexName}', but with different uniqueness configurations.</value>
309309
</data>
310310
<data name="DuplicateKeyColumnMismatch" xml:space="preserve">
311311
<value>The keys {keyProperties1} on '{entityType1}' and {keyProperties2} on '{entityType2}' are both mapped to '{table}.{keyName}', but with different columns ({columnNames1} and {columnNames2}).</value>

src/EFCore.SqlServer/Infrastructure/Internal/SqlServerModelValidator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ protected virtual void ValidateIndexIncludeProperties(
163163
throw new InvalidOperationException(
164164
SqlServerStrings.IncludePropertyNotFound(
165165
notFound,
166-
index.Name == null ? index.Properties.Format() : "'" + index.Name + "'",
166+
index.DisplayName(),
167167
index.DeclaringEntityType.DisplayName()));
168168
}
169169

@@ -179,7 +179,7 @@ protected virtual void ValidateIndexIncludeProperties(
179179
SqlServerStrings.IncludePropertyDuplicated(
180180
index.DeclaringEntityType.DisplayName(),
181181
duplicateProperty,
182-
index.Name == null ? index.Properties.Format() : "'" + index.Name + "'"));
182+
index.DisplayName()));
183183
}
184184

185185
var coveredProperty = includeProperties
@@ -191,7 +191,7 @@ protected virtual void ValidateIndexIncludeProperties(
191191
SqlServerStrings.IncludePropertyInIndex(
192192
index.DeclaringEntityType.DisplayName(),
193193
coveredProperty,
194-
index.Name == null ? index.Properties.Format() : "'" + index.Name + "'"));
194+
index.DisplayName()));
195195
}
196196
}
197197
}

src/EFCore.SqlServer/Metadata/Internal/SqlServerIndexExtensions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public static bool AreCompatibleForSqlServer(
3535
{
3636
throw new InvalidOperationException(
3737
SqlServerStrings.DuplicateIndexIncludedMismatch(
38-
index.Properties.Format(),
38+
index.DisplayName(),
3939
index.DeclaringEntityType.DisplayName(),
40-
duplicateIndex.Properties.Format(),
40+
duplicateIndex.DisplayName(),
4141
duplicateIndex.DeclaringEntityType.DisplayName(),
4242
index.DeclaringEntityType.GetSchemaQualifiedTableName(),
4343
index.GetDatabaseName(storeObject),
@@ -55,9 +55,9 @@ public static bool AreCompatibleForSqlServer(
5555
{
5656
throw new InvalidOperationException(
5757
SqlServerStrings.DuplicateIndexOnlineMismatch(
58-
index.Properties.Format(),
58+
index.DisplayName(),
5959
index.DeclaringEntityType.DisplayName(),
60-
duplicateIndex.Properties.Format(),
60+
duplicateIndex.DisplayName(),
6161
duplicateIndex.DeclaringEntityType.DisplayName(),
6262
index.DeclaringEntityType.GetSchemaQualifiedTableName(),
6363
index.GetDatabaseName(storeObject)));
@@ -72,9 +72,9 @@ public static bool AreCompatibleForSqlServer(
7272
{
7373
throw new InvalidOperationException(
7474
SqlServerStrings.DuplicateIndexClusteredMismatch(
75-
index.Properties.Format(),
75+
index.DisplayName(),
7676
index.DeclaringEntityType.DisplayName(),
77-
duplicateIndex.Properties.Format(),
77+
duplicateIndex.DisplayName(),
7878
duplicateIndex.DeclaringEntityType.DisplayName(),
7979
index.DeclaringEntityType.GetSchemaQualifiedTableName(),
8080
index.GetDatabaseName(storeObject)));
@@ -89,9 +89,9 @@ public static bool AreCompatibleForSqlServer(
8989
{
9090
throw new InvalidOperationException(
9191
SqlServerStrings.DuplicateIndexFillFactorMismatch(
92-
index.Properties.Format(),
92+
index.DisplayName(),
9393
index.DeclaringEntityType.DisplayName(),
94-
duplicateIndex.Properties.Format(),
94+
duplicateIndex.DisplayName(),
9595
duplicateIndex.DeclaringEntityType.DisplayName(),
9696
index.DeclaringEntityType.GetSchemaQualifiedTableName(),
9797
index.GetDatabaseName(storeObject)));

0 commit comments

Comments
 (0)