我在我的數據存儲庫中使用下面的代碼來返回實體列表。 我要綁定使用的WinForms BindingSource的列表中,然後才能夠支持和過濾的BindingSource創建支持IBindingListView的實體列表?
我目前使用類似
mybindingSource.datasource = repository.GetList(p => p.Id > 0 && p.Archived == false, x => x.Organisation);
然而mybindingSource.SupportsFilter返回false。
的庫函數是
public virtual IList<T> GetList(Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties)
{
List<T> list;
IQueryable<T> dbQuery = ((DbContext)this.context).Set<T>();
//Apply eager loading
foreach (var navigationProperty in navigationProperties)
{
dbQuery = dbQuery.Include(navigationProperty);
}
list = dbQuery.AsNoTracking().Where(where).ToList();
return list;
}
我也在調查圍繞數據集的包裝 – 2014-08-28 06:55:42
我問了一個相關的問題http://stackoverflow.com/questions/25558450/notifying-bindingsource-position-using-2-way-binding-in-winforms-to- select- – 2014-08-28 22:21:14
還使用Nuget的Equin.ApplicationFramework.BindingListView https://github.com/waynebloss/BindingListView – 2014-09-04 20:49:19