EF6 does not lazy load navigation property

后端 未结 1 538
予麋鹿
予麋鹿 2021-01-19 19:13

I\'m having an issue with EF6 lazy loading. I\'ve searched StackOverflow, but the other questions I\'ve found doesn\'t fit my case.

I\'m using the virtual

相关标签:
1条回答
  • 2021-01-19 19:35

    Entities must have explicitly declared public constructors if you want to use lazy loading via dynamic proxies. (If you have other with parameters)

    public abstract class BaseModel : ISoftDelete {
        public BaseModel() { }
        public int id { get; set; }
    }
    
    public class Course : BaseModel {
        public Course() { }
        [Required]
        public int presentationId { get; set; }
        public virtual Presentation presentation { get; set; }
    }
    
    0 讨论(0)
提交回复
热议问题