How to Serialize property of type ICollection while using Entity Framework

后端 未结 5 810
离开以前
离开以前 2021-01-04 10:14

I have a class as shown below

public class Survey
    {
        public Survey()
        {
            SurveyResponses=new List();
              


        
5条回答
  •  -上瘾入骨i
    2021-01-04 10:24

    Change the ICollection to a List

    public class Survey
    {
        public Survey()
        {
            SurveyResponses=new List();
        }
    
        [Key]
        public Guid SurveyId { get; set; }
        public string SurveyName { get; set; }
        public string SurveyDescription { get; set; }
        public virtual List Questions { get; set; }
        public virtual List SurveyResponses { get; set; }
    }
    

提交回复
热议问题