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

"Interesting" navigation named generated by reverse engineering #27832

Closed
ErikEJ opened this issue Apr 18, 2022 · 4 comments · Fixed by #29771
Closed

"Interesting" navigation named generated by reverse engineering #27832

ErikEJ opened this issue Apr 18, 2022 · 4 comments · Fixed by #29771
Assignees
Labels
area-scaffolding closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-bug
Milestone

Comments

@ErikEJ
Copy link
Contributor

ErikEJ commented Apr 18, 2022

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)

@ajcvickers
Copy link
Member

Weird... 🤷

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Apr 19, 2022

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

@smitpatel
Copy link
Member

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

@ajcvickers ajcvickers added this to the 7.0.0 milestone Apr 23, 2022
@ajcvickers
Copy link
Member

Possibly duplicate of #14278.

@ajcvickers ajcvickers added punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. and removed propose-punt labels Jul 7, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, Backlog Jul 7, 2022
@ajcvickers ajcvickers assigned ajcvickers and unassigned bricelam Dec 5, 2022
@ajcvickers ajcvickers modified the milestones: Backlog, 8.0.0 Dec 5, 2022
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Dec 5, 2022
ajcvickers added a commit that referenced this issue Dec 5, 2022
@ajcvickers ajcvickers modified the milestones: 8.0.0, 8.0.0-preview1 Jan 29, 2023
@ajcvickers ajcvickers modified the milestones: 8.0.0-preview1, 8.0.0 Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-scaffolding closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants