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
When I create an own-type class and try to configure it using OwnsOne(), ef creates an unnecessary foreign key to the parent table. If I remove UseSnakeCaseNamingConvention(), there is no foreign key for own type.
public abstract class Transport
{
public Guid Id { get; set; }
protected Transport()
{
}
}
public class Speed
{
public int Value { get; }
}
public class Car : Transport
{
public Speed Speed { get; set; }
}
When I create an own-type class and try to configure it using OwnsOne(), ef creates an unnecessary foreign key to the parent table. If I remove UseSnakeCaseNamingConvention(), there is no foreign key for own type.
How to reproduce
Link to my repo with bug: https://github.com/Gbsyi/EfTpt
There are some snippets from that repo.
Models:
Configuration:
What it creates:
Migration:
Migration.Designer:
What it will create if I'll remove UseSnakeCaseNamingConvention()
Migration:
Migration.Designer:
Provider and version information
EF Core version: 7.0.3
Database provider: Npgsql.EntityFrameworkCore.PostgreSQL 7.0.3
Target framework: NET 7.0
EFCore.NamingConventions version: 7.0.2
The text was updated successfully, but these errors were encountered: