Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document IndexBuilder.HasName breaking change #2680

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions entity-framework/core/what-is-new/ef-core-5.0/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The following API and behavior changes have the potential to break existing appl
| [IMigrationsModelDiffer now uses IRelationalModel](#relational-model) | Low |
| [Discriminators are read-only](#read-only-discriminators) | Low |
| [Provider-specific EF.Functions methods throw for InMemory provider](#no-client-methods) | Low |
| [IndexBuilder.HasName is now obsolete](#index-obsolete) | Low |

<a name="geometric-sqlite"></a>

Expand Down Expand Up @@ -338,3 +339,27 @@ Provider-specific methods map to a database function. The computation done by th
**Mitigations**

Since there's no way to mimic behavior of database functions accurately, you should test the queries containing them against same kind of database as in production.

<a name="index-obsolete"></a>

### IndexBuilder.HasName is now obsolete

[Tracking Issue #21089](https://github.com/dotnet/efcore/issues/21089)

**Old behavior**

Previously, only one index could be defined over a given set of properties. The database name of an index was configured using IndexBuilder.HasName.

**New behavior**

Multiple indexes are now allowed on the same set or properties. These indexes are now distinguished by a name in the model. By convention, the model name is used as the database name; however it can also be configured independently using HasDatabaseName.

**Why**

In the future, we'd like to enable both ascending and descending indexes or indexes with different collations on the same set of properties. This change moves us another step in that direction.

**Mitigations**

Any code that was previously calling IndexBuilder.HasName should be updated to call HasDatabaseName instead.

If your project includes migrations generated prior to EF Core version 2.0.0, you can safely ignore the warning in those files and suppress it by adding `#pragma warning disable 612, 618`.