I have the following classes that I am using with EF5
public class Question { public Question() { this.Answers = new List<Answer>(); } public int QuestionId { get; set; } ... ... public string Title { get; set; } public virtual ICollection<Answer> Answers { get; set; } } public class Answer { public int AnswerId { get; set; } public string Text { get; set; } public int QuestionId { get; set; } public virtual Question Question { get; set; } } Can someone tell me why there is a need for the property:
public virtual Question Question { get; set; } If I never intend to do automatic lazyloading but do intend to sometimes bring that object in with an include then do I need the virtual property like this:
var questions = _questionsRepository.GetAll() .Include(a => a.Answers); The reason I am asking is because when used with Web API it is giving me circular reference errors with json.