0
affern created
Hi again guys. I have created a domain class with a composite keys:
public class MultiAnswer
{
[Key]
[Column(Order = 1)]
public long SurveyId { get; set; }
[Key]
[Column(Order = 2)]
public long UserId { get; set; }
[Key]
[Column(Order = 3)]
public int ItemId { get; set; }
[Required]
public int AnswerId { get; set; }
public DateTime DateAnswer { get; set; }
[ForeignKey("SurveyId")]
public virtual Survey Survey { get; set; }
}
But how do I declare a MultiAnswer Repository with 3 keys? The IRepository is for one primary key.
4 Answer(s)
-
0
But how do I declare a MultiAnswer Repository with 3 keys?
You cannot.
The IRepository is for one primary key.
Exactly.
-
0
So the best solution is to create a new MultiAnswerRepository class and a IMultiAnswerRepository interface and solve this dependency injection separatley?
-
0
Yes.
-
0
Ok. Thanks :-)