Skip to content

"Interesting" navigation named generated by reverse engineering #27832

Closed

Description

@ErikEJ

Include your code

Given the following two tables:

CREATE TABLE [dbo].[TmTvSeason](
	[Id] [int] NOT NULL,
	[ShowId] [int] NOT NULL,
	[AirDate] [date] NULL,
	[Name] [nvarchar](300) NULL,
	[Overview] [nvarchar](max) NULL,
	[PosterPath] [nvarchar](300) NULL,
	[SeasonNumber] [int] NULL,
	[ThePoster] [varbinary](max) NULL,
	[SubDir] [nvarchar](max) NULL,
	[TvSeasonAdded] [datetime] NULL,
	[Gesehen] [bit] NULL,
 CONSTRAINT [PK_TmTvSeason] PRIMARY KEY CLUSTERED 
(
	[ShowId] ASC,
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[TmTvEpisode](
	[Id] [int] NOT NULL,
	[SeasonId] [int] NOT NULL,
	[ShowId] [int] NOT NULL,
	[AirDate] [date] NULL,
	[EpisodeNumber] [int] NULL,
	[Name] [nvarchar](300) NULL,
	[Overview] [nvarchar](max) NULL,
	[ProductionCode] [nvarchar](20) NULL,
	[SeasonNumber] [int] NULL,
	[StillPath] [nvarchar](300) NULL,
	[VoteAverage] [float] NULL,
	[VoteCount] [int] NULL,
	[TheStill] [varbinary](max) NULL,
	[File] [nvarchar](max) NULL,
	[TvEpisodeAdded] [datetime] NULL,
	[LastView] [datetime] NULL,
	[MediaInfo] [nvarchar](max) NULL,
	[VideoResolution] [nchar](10) NULL,
	[Codec] [nchar](100) NULL,
	[Gesehen] [bit] NULL,
	[KodiId] [nchar](10) NULL,
	[KodiPlayCount] [int] NULL,
	[Runtime] [int] NULL,
	[FileSize] [bigint] NULL,
 CONSTRAINT [PK_TmTvEpisode] PRIMARY KEY CLUSTERED 
(
	[ShowId] ASC,
	[SeasonId] ASC,
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[TmTvEpisode]  WITH CHECK ADD  CONSTRAINT [FK_TmTvEpisode_TmTvSeason] FOREIGN KEY([ShowId], [SeasonId])
REFERENCES [dbo].[TmTvSeason] ([ShowId], [Id])
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[TmTvEpisode] CHECK CONSTRAINT [FK_TmTvEpisode_TmTvSeason]
GO

the following quirky navigation name is generated:

   public partial class TmTvEpisode
   {
    public int Id { get; set; }
    public int SeasonId { get; set; }
    public int ShowId { get; set; }
    public DateTime? AirDate { get; set; }
    public int? EpisodeNumber { get; set; }
    public string Name { get; set; }

    **public virtual TmTvSeason S { get; set; }**
  }

Include provider and version information

EF Core version: 6.0.2
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Windows
IDE: (e.g. Visual Studio 2022 17.1)

Activity

  1. ajcvickers commented on Apr 19, 2022

    @ajcvickers
    Contributor

    Weird... 🤷

  2. ErikEJ commented on Apr 19, 2022

    @ErikEJ
    ContributorAuthor

    "interesting" - "weird" - "strange" 👻

  3. smitpatel commented on Apr 22, 2022

    @smitpatel
    Contributor

    "S" could be side-effect of common prefix of fk properties.

  4. added this to the 7.0.0 milestone on Apr 23, 2022
  5. ajcvickers commented on Apr 23, 2022

    @ajcvickers
    Contributor

    Possibly duplicate of #14278.

  6. modified the milestones: 7.0.0, Backlog on Jul 7, 2022
  7. modified the milestones: Backlog, 8.0.0 on Dec 5, 2022
  8. added a commit that references this issue on Dec 5, 2022
    943607b
  9. modified the milestones: 8.0.0, on Jan 29, 2023
  10. modified the milestones: , 8.0.0 on Nov 14, 2023
  11. removed their assignment
    on Aug 31, 2024
  12. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions