问题
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