Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Table with two Primary keys not generated properly in context #14

Closed
Falthazar opened this issue Aug 18, 2018 · 1 comment
Closed

Table with two Primary keys not generated properly in context #14

Falthazar opened this issue Aug 18, 2018 · 1 comment
Labels
bug Confirmed bug

Comments

@Falthazar
Copy link
Contributor

Visual Studio 15.7.5
Entity Framework Visual Editor 1.2.2.1
Using EFCore

I have three tables:
Site, Investigator, and a join table to link the two (for many-to-many relationship)
The join table just has InvestigatorId and SiteId properties, and I set them both to Identity = True

The generated context does this:

modelBuilder.Entity<EFCoreDesignTools.JoinSiteInvestigator>()
            .ToTable("JoinSiteInvestigators")
            .HasKey(t => new { t.public Int32 InvestigatorId!, t.public Int32 SiteId! });

Should be:

modelBuilder.Entity<EFCoreDesignTools.JoinSiteInvestigator>()
            .ToTable("JoinSiteInvestigators")
            .HasKey(t => new { t.InvestigatorId, t.SiteId });
Falthazar added a commit to Falthazar/EFDesigner that referenced this issue Aug 18, 2018
msawczyn added a commit that referenced this issue Aug 20, 2018
…rly in context (#14). Many thanks to @Falthazar!

- Fix for issue #12 - Cascade delete (#14). Added another enum value for delete behavior (now is Cascade, None and Default) and changed code generation to force no cascade delete if set to 'None' ('None' used to mean 'Use the default behavior', which is now, more explicitly, the 'Default' option).

Changed docs to reflect above.

Version change to 1.2.3
@msawczyn
Copy link
Owner

Fixed in v1.2.3

@msawczyn msawczyn added the bug Confirmed bug label Aug 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants