Reputation: 10650
I have a database model in entity framework. The edmx has some tables and now I am trying to add two new ones (they are junction tables). I have seen that someone added these 2 tables in the past but for some reason these tables were not being shown in the diagram. They are not listed in the list of Entity Types (under Diagram node), but I do see it in the Entity Store.
I have done below things:
These 2 tables have their primary key and also foreign keys pointing to other tables already shown in the edmx diagram. Also these 2 tables are junction tables as a result of a many to many relationship between 2 tables.
Also I have restarted visual studio, clean all the solution and rebuild again without success.
Any idea what can I do to add these 2 tables?
UPDATE #1: Also classes are not being created in the disk.
SQL Server definition for one of the tables is as below (the another table is similar):
CREATE TABLE [dbo].[DeptPerson](
[deptId] [int] NOT NULL,
[personId] [varchar](20) NOT NULL,
CONSTRAINT [PK_DeptPerson] PRIMARY KEY CLUSTERED
(
[deptId] ASC,
[personId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
) ON [PRIMARY]
ALTER TABLE [dbo].[DeptPerson] WITH CHECK ADD CONSTRAINT [FK_DeptPerson_Department] FOREIGN KEY([deptId])
REFERENCES [dbo].[Department] ([deptId])
GO
ALTER TABLE [dbo].[DeptPerson] CHECK CONSTRAINT [FK_DeptPerson_Department]
GO
ALTER TABLE [dbo].[DeptPerson] WITH CHECK ADD CONSTRAINT [FK_DeptPerson_Person] FOREIGN KEY([personId])
REFERENCES [dbo].[Person] ([personId])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DeptPerson] CHECK CONSTRAINT [FK_DeptPerson_Person]
GO
UPDATE #2: AS Gert Arnold explained, junction tables (intermediate tables) are being hidden by design in many to many relationship (my case). Also it is confirmed in this post. I didn't know that junction tables were being hidden by design...
Upvotes: 0
Views: 177