0
嗨,我在這裏有一個代碼片段。這是不是我的,我在網上看到這個,而在如何應對Entity Framework
學習我知道這只是包括(貪婪加載)的導航屬性然後返回它作爲IQueryable
如何用params關鍵字讀取參數並實現函數
我想知道的是:
如何讀取此參數
params System.Linq.Expressions.Expression<Func<T, object>>[] includeProperties
?你如何打電話或使用此功能? (要經過收集,對嗎?一個小例子將是一個很大的幫助,因爲我的方式學習,當我看到一些演示)
public IQueryable<Customer> AllIncluding(params System.Linq.Expressions.Expression<Func<T, object>>[] includeProperties) { var query = context.Customers; foreach (var includeProperty in includeProperties) { query = query.Include(includeProperty); } return query; }
任何幫助將非常感激。謝謝!
當您查閱關於'params'關鍵字的文檔時,您發現了什麼,以及您發現哪些具體方面令人困惑? – Servy
關於#1:我不會真的大聲朗讀整件事,但我經常談到以「params陣列」爲參數的方法。 – StriplingWarrior