DataBinding from Entity Framework to Listivew dataSource
My entity is returning the following:
class StoreClass{
public Entry GetStoreInfo(int id, UserInfo userInfo)
{
using (var context = new StoreEntities())
{
var query = from a in context.Store
.Include("Ratings")
.Include("Versions")
.Include("Versions.Installers")
.Include("Versions.Installers.Screenshots")
.Include("Category")
where a.ID == id && a.IsActive
select a;
return query.FirstOrDefault();
}
}
}
I am trying to bind the data data returned form the above function to the listview.
StoreClass objStore = new StoreClass ();
Listview1.DataSource = objStore .GetStoreInfo(1,userInfo);
LstAppletInfo.DataBind();
}
But its throwing an error "Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDa开发者_高级运维taSource."
Help me solve this!!!
public IEnumerable<Entry> GetStoreInfo(int id, UserInfo userInfo)
{
...
return query;
}
精彩评论