You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: entity-framework/core/modeling/indexes.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,12 +106,12 @@ You can set the name of the index created in the database:
106
106
Note that if you call `HasIndex` more than once on the same set of properties, that continues to configure a single index rather than create a new one:
107
107
108
108
```csharp
109
-
modelBuilder.Entity<Blog>()
110
-
.HasIndex(b=>new { b.FirstName, b.LastName })
109
+
modelBuilder.Entity<Person>()
110
+
.HasIndex(p=>new { p.FirstName, p.LastName })
111
111
.HasDatabaseName("IX_Names_Ascending");
112
112
113
-
modelBuilder.Entity<Blog>()
114
-
.HasIndex(b=>new { b.FirstName, b.LastName })
113
+
modelBuilder.Entity<Person>()
114
+
.HasIndex(p=>new { p.FirstName, p.LastName })
115
115
.HasDatabaseName("IX_Names_Descending")
116
116
.IsDescending();
117
117
```
@@ -121,11 +121,11 @@ Since the second `HasIndex` call overrides the first one, this creates only a si
121
121
To create multiple indexes over the same set of properties, pass a name to the `HasIndex`, which will be used to identify the index in the EF model, and to distinguish it from other indexes over the same properties:
0 commit comments