Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported. Load not there

I am using EF and I have the following code in which I am trying to get rows from a view called interface5toSSHIP. The SQL Explorer reveals that the database view has one row right now. The following query doesn't seem to return it. What am I doing wrong?

IEnumerable<interface5toSSHIP> i5;
            using (RREM_GilbaneEntities3 entities3 = new RREM_GilbaneEntities3())
            {
                i5 = from i in entities3.interface5toSSHIP
                select i;
            }

Then I get the title error when I attempt to DataBind it:

grdvwInterface5ReadyToSend.DataSource = i5;
            grdvwInterface5ReadyToSend.AllowPaging = true;
            grdvwInterface5ReadyToSend.AllowSorting = true;
            grdvwInterface5ReadyToSend.DataBind();

The problem is I can't find how to do the Load. I looked up an example like this:

IntranetModelContainer db = new IntranetModelContainer();
      db.Entities.OfType<Employee>().Load();
      return db.Entities.Local.OfType<Employee>();

I added a reference to System.Data.Entity and I can't find a .Entities off my entities3 or a LOad method. How do I do this?

Answers


I solved it by calling the ToList() method on it.


ToList() can be too slow, because it will try to get all properties (get{}) and resolve another objects related to it. A fast way can be:

yourLinq.AsQueryable()

Need Your Help

Coverflow in HTML5 for iPhone/iPod Touch

iphone html5 webkit ipod-touch coverflow

I have to do a web page destined for iPhone and iPod-touch that needs to incorporate the Coverflow style of apple in a page to display a list of videos.

Testing Devise session timeout with RSpec

ruby-on-rails rspec devise session-timeout warden

I'd like to customize the time period after which my Rails app will automatically end a user's session.