How do I load related entities of type IEnumerable

后端 未结 2 1608
猫巷女王i
猫巷女王i 2020-12-21 04:09

I\'m trying to load related entities of a SingleOrDefault entity, but I am getting the following exception:

The navigation property of type IEnumerable is not a sing

相关标签:
2条回答
  • 2020-12-21 04:41

    IEnumerable<T> is not supported as a type for a navigation collection. You must use ICollection<T> or another interface derived from it (for example IList<T>) or a concrete implementation of ICollection<T> - like List<T>, HashSet<T>, etc.

    0 讨论(0)
  • 2020-12-21 04:53

    That's because you need ICollection instead of IEnumerable.

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