There error is as the title states: Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported. I've tried searching for possible fixes, but couldn't find the one that was working for me.
Here is my DataLayer:
public virtual IQueryable<T> All()
{
return this.DbSet.AsQueryable();
}
My Controller:
public IQueryable<Movie> GetAllMovies()
{
var data = this.Data.Movies.All().Select(x => new Movie
{
Id = x.Id,
Name = x.Name,
ReleaseDate = x.ReleaseDate,
Rating = x.Rating,
Duration = x.Duration,
Director = x.Director,
Writer = x.Writer,
Cost = x.Cost,
Type = x.Type
}).OrderBy(x => x.Id);
return data;
}
And my GUI where I am calling it:
public MovieManagementGUI()
{
InitializeComponent();
***this.radListView1.DataSource = movieCtr.GetAllMovies();*** //<-- Here I am getting the error
this.radListView1.ViewType = ListViewType.IconsView;
this.radListView1.AllowEdit = false;
this.radListView1.AllowRemove = false;
ImagePrimitive searchIcon = new ImagePrimitive();
searchIcon.Alignment = ContentAlignment.MiddleRight;
SetupIconsView();
}
I am trying to fetch all the data from the the DB and post it in a ListView. Can somebody look at the code and try fixing me up and if you need additional code, let me know.
Thank you,
Marius J.