[英]Is it possible to have Entity Framework use List<T> instead of ICollection<T> when generating classes from the DB?
標題很容易說明。 我想讓我的EF自動生成的部分類使用ICollection的List intead。
是的。 我已經做了很多次了。 您在生成它時遇到一些問題嗎?
例如: public virtual List<Property> Properties { get; set; }
public virtual List<Property> Properties { get; set; }
否,因為當您點擊.ToList()會返回列表EF時,它將與查詢一起訪問數據庫,因此始終最好在末尾計算.ToList
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.