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

[6.0.1] Return null schema for unmapped entity types. #26730

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

AndriySvyryd
Copy link
Member

Fixes #26651

Description

We started including the default schema in each ToTable call in the model snapshot, even if it was to mark an entity type as not mapped - ToTable(null, "schema"), which doesn't work.

Customer impact

If the model has a default schema and unmapped entity types the model snapshot in the generated migration throws an exception when used.

How found

Customer reported on 6.0

Regression

Yes, this worked in 5.0

Testing

Added test for this scenario.

Risk

Low, the fix just affects models with unmapped entity types. Also added a quirk mode.

@AndriySvyryd AndriySvyryd added this to the 6.0.x milestone Nov 17, 2021
@AndriySvyryd AndriySvyryd requested a review from a team November 17, 2021 19:28
@AndriySvyryd AndriySvyryd changed the title [6.0.x] Return null schema for unmapped entity types. Return null schema for unmapped entity types. Nov 17, 2021
@AndriySvyryd AndriySvyryd merged commit 1a29900 into release/6.0 Nov 17, 2021
@AndriySvyryd AndriySvyryd deleted the Issue26651 branch November 17, 2021 22:04
@AndriySvyryd AndriySvyryd removed this from the 6.0.x milestone Nov 17, 2021
@ajcvickers ajcvickers changed the title Return null schema for unmapped entity types. [6.0.1] Return null schema for unmapped entity types. Nov 18, 2021
@marekott
Copy link

Hi @AndriySvyryd, I have a question regarding database views and their schema after this change.

if (entityType.GetTableName() == null)
If statement above will always return null if it is called on entity representing database view. For views there is a seperate method:
public static string? GetViewName(this IReadOnlyEntityType entityType)

Is it expected behaviour? With "Microsoft.EntityFrameworkCore.Relational" Version="6.0.0" checking schema name with
public static string? GetSchema(this IReadOnlyEntityType entityType)
for entity being database view would return correct schema, not null like now.

@AndriySvyryd
Copy link
Member Author

@marekott That's the intended behavior. Use GetViewSchema() instead.

@marekott
Copy link

Ok, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants