In a previous question on Stack Overflow, I had run into an issue with returning an EF query to the DataGridView. Of course I'd run into an issue. However, I added an extension method that still has me baffled since it isn't working. It seems like it should, but for some reason it's not.
public static class BindingListEntityExtension
{
public static BindingList<T> ToBindingList<T>(this IEnumerable<T> entities)
{
BindingList<T> rtn = new BindingList<T>();
foreach (T obj in entities)
{
rtn.Add(obj);
}
return rtn;
}
}
Any ideas what's going on? My implementation is like so:
MyEntities context = new MyEntities();
tempDataGridView.DataSource = context.Employees.ToBindingList();