In my .NET Core project I got this class that represent a table in the DB that has a key composed by three fields:
public class Turn
{
[Column(Order = 1)]
[ForeignKey("playerHost")]
public string ownerId { get; set; }
[Column(Order = 2)]
[ForeignKey("match")]
public Guid matchId { get; set; }
[Column(Order = 3)]
public int counterKey { get; set; }
}
I would like to have the counterKey as an autoincrement but it has to increment according to the values of matchId and ownerId. So for every pair of <matchId, ownerId> there will be a counter that increment for every new entry. How can I do this in EF Core?
Thank you!