Entity Framework - Changing Multiple Relationships

I have a [User] table and another [Salesperson] table in my database. [Salesperson] defines a unique UserID that maps to [User] .UserID with a foreign key. When I generate a model with the Entity Framework, I get a 1-to-many relationship between [User] - [Salesperson], which means that each user has a "Seller Collection", but what I want is 0. .1-to -1, where each user has a link with a zero value for the "Seller".

I tried to combine with XML and changed the plurality of linking options, but that only caused build errors. What I'm trying to achieve is no different from what in [User] is NULL SalespersonID, which refers to [Salesperson] .SalespersonID, but since sellers exist only for specific users, it looks like I'll mess up my table structure [User] to get the link, to specify the correct path in the Entity Framework.

Is there anything I can do to change the multiplicity of relationships?

+3
source share
1 answer

PK Salesperson FK User. EF GUI , .

+2

Source: https://habr.com/ru/post/1722745/


All Articles