My problem is in the title. I want to make a composite primary key as bidirectional. What I mean by bidrectional? Let me explain:
I have a friendship table. Primary keys are: SenderId and ReceiverId
In OnModelCreating:
builder.Entity<Friendship>()
.HasKey(i => new { i.SenderId, i.ReceiverId });
So my friendship entities have primary keys like {SenderId, ReceiverId}. But not like {ReceiverId, SenderId}. I want to make keys to be both ways. In this way, my friendship requests will be unique and I will not create duplicate friendship requests as follows:
Is this possible?
NOTE: I know how to check if there is a entry with those IDs.But I want to implement the database to reject the new entry with the same IDs in both ways.