question

VascoFerreira-6636 avatar image
0 Votes"
VascoFerreira-6636 asked ZhiLv-MSFT commented

EF6 Designer relationship with two tables where only one key matches

Hello,
I am trying to match two tables with a column in common which is of type Guid, however in one of them that column is not key ( which i could change ) but in the other table i also have another key that has no match with the first table. So when i try to associate the two, if i pick the first as the main table it does not show the column i want and if i pick the second i get left with an extra column that i can't match.
Is there a way to accomplish what i am trying to do?

Best regards,
Vasco.

dotnet-aspnet-core-blazordotnet-entity-framework
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Vasco,

Can you post the relate table structure and its related columns, and tell us which column is the Guid column and the foreign key? It is easier to understand what you want and help you fix the problem.

Besides, when using EF core/ EF to configure the relationship between tables, we could use the navigation property, and use the ForeignKey attribute or HasForeignKey method to set the foreign key. You can refer the following articles:

Relationships

Data Annotations - ForeignKey Attribute in EF 6 & EF Core

Configure One-to-Many Relationships in EF 6

0 Votes 0 ·

0 Answers