This tag is for questions about LINQ to Entities, which means LINQ queries using the ADO.NET Entity Framework. Note that this is different than LINQ to SQL or other LINQ providers.
1
vote
0answers
8 views
Linq to Entities - is count() clever enough to send a group by clause to the DB
This is surprisingly difficult to find, and as I am an amateur using express edition of VS, I don't believe I can see the SQL being sent to the DB (although happy to be corrected).
If I want the ...
0
votes
1answer
15 views
Entity Framework : map duplicate tables to single entity at runtime?
I have a legacy database with a particular table -- I will call it ItemTable -- that can have billions of rows of data. To overcome database restrictions, we have decided to split the table into ...
20
votes
10answers
19k views
Linq to Entities, random order
How do i return matching entities in a random order?
Just to be clear this is Entity Framework stuff and LINQ to Entities.
(air code)
IEnumerable<MyEntity> results = from en in ...
2
votes
3answers
3k views
Could not find Control in ControlParameter inside EditItemTemplate
I am working on a Dynamic Data website and I have run into a wall. I have a Details page where the details for each employee can be seen, and then I have a separate page to edit each employee. I did ...
3
votes
2answers
2k views
How do you add a primary key to a sql view? - Or alternate way to link views to LINQ-2-Entities
I'm adding a very simple view (or trying to) to my entities object model. The database is in SQL Server 2008. I'm on .Net 3.5 (SP1) using C#.
The view has two fields: color and colorcount, a ...
0
votes
1answer
20 views
LINQ - loading data from tables with circular references
I have the below tables where the StationAvailableMoves.StationID and StationAvailableMoves.AvailableNextStationID both have relationships on the Station.ID column.
I am using this to control a ...
4
votes
1answer
78 views
OUTER APPLY in .net 4.5 and Entity Framework
After installing the .Net 4.5, there were problems in queries generated by EF. The same query in linq to .Net 4.0 works correctly. I'm using Firebird database and it does not support command OUTER ...
1
vote
2answers
23 views
Get only some properties from an entity using Repository pattern and LINQ2Entities
I know it's pretty standard stuff but right know the solution escapes me. I have entity Documents. In my service I can call DocumentsRepository.All() and then use only what I need but I don't want to ...
0
votes
0answers
11 views
Fast native SQL, but slow LINQ-to-SQL
See the following simple queries:
var stringList = db.A.Where(a => IsTrue == true).Select(a => a.string);
foreach string in stringList:
var c1 = db.ExecuteQuery<int>("SELECT COUNT(*) ...
2
votes
2answers
28 views
LINQ to Entities using the SQL LIKE operator
I have this:
query = query.Where(s => s.ShowTypeDescription == showTypeDescription);
several times for different variables in order to build dynamic SQL.
How would I go about transforming the ...
-2
votes
0answers
8 views
Linq to Sql on Multiple select and groupjoin
I've got the below SQL query working.I need help on how to handle it in linq to sql.
select * from (
select sharerepo.Status status,Users.UserName,Users.UserId from class
join section on ...
2
votes
2answers
42 views
LINQ Left Outer Join with conditions
I have the below tables that are coming from my SQL Database with Entity Framework 5.
What I want to do is select all users where tblUserBusiness.BUID equals a passed in value OR where the ...
18
votes
5answers
7k views
'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported
I am trying to execute the following code and am receiving an error
public List<Log> GetLoggingData(DateTime LogDate, string title)
{
var context = new LoggingEntities();
...
2
votes
3answers
804 views
The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties
Using this code in Entity Framework I receive the following error. I need to get all the rows for a specific date, DateTimeStart is of type DataType in this format 2013-01-30 12:00:00.000
Any idea?
...
2
votes
1answer
39 views
How to efficiently build a “Get descendants” algorithm in linq-to-entities?
In a tree like the one below where each item knows only its parent id and order number, what would be a good way to query all descendants of Foo?
1: Foo
2: Child
3: Grandchild 1
4: Grandchild 2
...