简体   繁体   中英

Is it possible to have Entity Framework use List<T> instead of ICollection<T> when generating classes from the DB?

Title is pretty self explanatory. I would like to have my EF autogenerated partial classes to use List intead of ICollection.

Yes, it is. I have done so many times. Are you having some problems generating it?

Ex: public virtual List<Property> Properties { get; set; } public virtual List<Property> Properties { get; set; }

否,因为当您点击.ToList()会返回列表EF时,它将与查询一起访问数据库,因此始终最好在末尾计算.ToList

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM