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 DbFunctionBuilder.HasSchema(null) breaking change #3497

Merged
merged 1 commit into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
"XML"
],
"cSpell.words": [
"LINQ",
"dbcontext",
"denormalization",
"idempotency",
"LINQ",
"mitigations",
"navigations",
"overridable",
"parameterizable",
"pluralizer",
"queryable",
Expand Down
23 changes: 23 additions & 0 deletions entity-framework/core/what-is-new/ef-core-6.0/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The following API and behavior changes have the potential to break existing appl
| [New caching API for extensions that add or replace services](#extensions-caching) | Low* |
| [New snapshot model initialization procedure](#snapshot-initialization) | Low |
| [`OwnedNavigationBuilder.HasIndex` returns a different type now](#owned-index) | Low |
| [`DbFunctionBuilder.HasSchema(null)` overrides `[DbFunction(Schema = "schema")]`](#function-schema) | Low |
| [Pre-initialized navigations are overridden by values from database queries](#overwrite-navigations) | Low |
| [Unknown enum string values in the database are not converted to the enum default when queried](#unknown-emums) | Low |

Expand Down Expand Up @@ -469,6 +470,28 @@ The returned builder object wasn't typed correctly.

Recompiling your assembly against the latest version of EF Core will be enough to fix any issues caused by this change.

<a name="function-schema"></a>

### `DbFunctionBuilder.HasSchema(null)` overrides `[DbFunction(Schema = "schema")]`

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

#### Old behavior

In EF Core 5, calling <xref:Microsoft.EntityFrameworkCore.Metadata.Builders.DbFunctionBuilder.HasSchema%2A> with `null` value didn't store the configuration source, thus <xref:Microsoft.EntityFrameworkCore.DbFunctionAttribute> was able to override it.

#### New behavior

Calling <xref:Microsoft.EntityFrameworkCore.Metadata.Builders.DbFunctionBuilder.HasSchema%2A> with `null` value now stores the configuration source and prevents the attribute from overriding it.

#### Why

Configuration specified with the <xref:Microsoft.EntityFrameworkCore.ModelBuilder> API should not be overridable by data annotations.

#### Mitigations

Remove the `HasSchema` call to let the attribute configure the schema.

<a name="overwrite-navigations"></a>

### Pre-initialized navigations are overridden by values from database queries
Expand Down