Are IEnumerable collection supported in EF 4.1 for mapping?

痴心易碎 提交于 2019-12-10 23:22:10

问题


I remember this was a problem with previous version of EF. You couldnt make collections as IEnumerable for exposing your methods instead. This is a problem because i don't want someone to directly access the collection.

See this for more info on what i am talking about... Why does the entity framework need an ICollection for lazy loading?

So the question is.. are EF 4.1 now support IEnumerable property for mapping relationship ? or is there a solution to this ?

Thanks.


回答1:


No it doesn't support IEnumerable because EF internally needs collection which can be assigned and filled by calling Add.



来源:https://stackoverflow.com/questions/7417326/are-ienumerable-collection-supported-in-ef-4-1-for-mapping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!