Skip to content Skip to sidebar Skip to footer

Ef6 Does Not Generate Foreign Key Association From Database

PROBLEM: I am trying to create a EF6 model using the database first approach. Simply speaking, I have 2 tables tblUser and tblMilkMan which have a foreign key relationship on the U

Solution 1:

The problem is the following line -

CREATE UNIQUE NONCLUSTERED INDEX [IX_tblUser] ON [dbo].[tblUser] ([UserID])
WITH (FILLFACTOR=90, DATA_COMPRESSION = ROW) ON [PRIMARY]
GO

I do not know the reason behind having Clustered and NonClustered indexes on same column. A common best practice is to create a Primary Key as Clustered Index. (Source)

If you delete that NONCLUSTERED INDEX, it will see the relation in EDMX.

How to delete it?

enter image description here

enter image description here

Post a Comment for "Ef6 Does Not Generate Foreign Key Association From Database"