0

I have some problems working with model first many to many relationship. Since I created many-many relationship between Town and Author via interface builder it created table TownAuthor with keys Towns_TownID and Authors_AuthorID but I want that just to be called TownID and AuthorID, how do I change that?

In Code first I would use that modelBuilder configuration in Context but I have no idea how to do this via model first...

Lukas G
  • 650
  • 1
  • 11
  • 33
Želja Huber
  • 337
  • 5
  • 14

1 Answers1

1

You have to change the names of these columns in the Entity Designer DDL script (which is generated from the EDMX file and has ModelName.edmx.sql name) before executing it.

-- Creating table 'TownAuthor'
CREATE TABLE [dbo].[TownAuthor] (
    [TownID] int  NOT NULL,
    [AuthorID] int  NOT NULL
);
GO
Lukas G
  • 650
  • 1
  • 11
  • 33