Skip to content

Conversation

@paulirwin
Copy link
Member

Even though the type has the [Key] attribute, the change to the explicit interface Id property broke EF Core's key detection. I believe this is fundamentally an EF Core bug, but we can work around it by explicitly specifying the key in the context builder logic.

Even though the type has the `[Key]` attribute, the change to the explicit interface Id property broke EF Core's key detection. I believe this is fundamentally an EF Core bug, but we can work around it by explicitly specifying the key in the context builder logic.
@paulirwin paulirwin requested a review from Copilot August 1, 2025 14:51

This comment was marked as outdated.

@paulirwin paulirwin marked this pull request as ready for review August 1, 2025 18:47
@paulirwin paulirwin requested a review from Copilot August 1, 2025 18:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an EF Core key detection issue that occurred after changing the Id property to an explicit interface implementation. The fix explicitly configures the primary key in the DbContext's OnModelCreating method.

  • Adds explicit key configuration for SyncLogEntry entity in EF Core context
  • Adds comprehensive test coverage for the SyncLogDbContext functionality
  • Includes Entity Framework Core InMemory package for testing

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Syncerbell.Tests/Syncerbell.Tests.csproj Adds EF Core InMemory package and project reference for testing
Syncerbell.Tests/SyncLogDbContextTests.cs Comprehensive test suite covering CRUD operations and EF Core functionality
Syncerbell.EntityFrameworkCore/SyncLogDbContext.cs Explicitly configures primary key to fix EF Core key detection issue

@paulirwin paulirwin merged commit 0513b46 into main Aug 1, 2025
1 check passed
@paulirwin paulirwin deleted the bugfix/missing-key branch August 1, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants