Entity Framework doesn't support mapping navigation properties of bare Array types. The property has to be of Type that implements the ICollection<T>
interface in order to be mapped.
Try to change your code as follows:
public class Question
{
public int Id { get; set; }
public string Text { get; set; }
public virtual ICollection<Answer> Answers { get; set; }
}
And when initializing Answers
, set it to a HashSet
or List
:
this.Answers = new List<Answer>();