Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find an implementation of the query 'Select' not found

Tags:

c#

database

linq

My error is:

Could not find an implementation of the query pattern for source type 'System.Data.Entity.Database'. 'Select' not found.

My relevent code is:

DatabaseEntities db = new DatabaseEntities();   
var whichUi = from UiType in db.Database
              select  AdvancedUi;

I am using the linq import (common answer on other threads).

like image 818
user3658489 Avatar asked Jul 15 '14 07:07

user3658489


1 Answers

I think your error is that you try to select something from .Database directly, not from the table. Instead of this code:

from UiType in db.Database

try out something like this:

from UiType in db.UiTypes
select UiType.AdvancedUi;

This should work as the table UiTypes will implemet the IEnumerable interface.

You should put your table name after the in keyword.
UiType is just a placeholder, and can be anything you want. Please, pay attention to the select clause - you must use the placeholder there, not the table name.

like image 61
VMAtm Avatar answered Sep 24 '22 18:09

VMAtm