Private constructor on POCO entity preventing lazy loading

后端 未结 1 1921
感情败类
感情败类 2021-01-18 07:16

I have a POCO entity on which I have defined a custom constructor. I have also implemented the default constructor so that Entity Framework can successfully hydrate the obje

相关标签:
1条回答
  • 2021-01-18 07:26

    If you define private constructor you violate requirements for creating POCO proxy responsible for lazy loading:

    A custom data class must have a public or protected constructor that does not have parameters.

    So the best option for you is using protected constructor or not using lazy loading.

    0 讨论(0)
提交回复
热议问题