Answer the question
In order to leave comments, you need to log in
How to implement an "either or" relationship in a table? (checkerboard order)?
Good afternoon.
There is a certain table in which there are two columns "PrivatePersonId" and "JuridicPersonId"
Columns are not part of the key, but have a relationship with each other:
Either one column is filled, or the second.
{Id,PrivatePersonId,JuridicPersonId}And in the main table, leave the "SellerId" column with a link to the ID of the "Seller" table.
if (Obj.Sellser.PrivatePerson != null){
Console.Writeline(obj.Seller.PrivatePerson.Name);
....}
else
{
Console.Writeline(obj.Seller.JuridicPerson.Name);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question