msawczyn/EFDesigner

Table with two Primary keys not generated properly in context

Falthazar opened this issue · 1 comments

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 });

Fixed in v1.2.3