I've a database in SQLServer 2008.
I've a table "Table1" with three rows as the primary key and I need to create a relationship with another table "Table2" but I don't want to add the three fields of Table1 in Table2 to be able to create the relationship.
So I've added a new field in Table1 named IdRow of type Int and Indentity=yes and I've created an index of type "Unique Key" for this new field so I can create the relationship based on this new field instead the three others.
So far so good but when I import the two tables into the model in the Entity Framework's model it doesn't recognize the IdRow as unique so I can't create the relationship with Table2 based on this field.
Can someone help me with this?
Is there a workaround to solve this or I've to add the three fields of Table1 in Table2 to create the relationship?
Well, I would do the opposite.
Can't you put the new idRow as the primary key, and add a UNIQUE Constraint on your 3 other fields ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.