Questions tagged [linq-to-entities]

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.

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.

Related Links

6860 questions
2
votes
2 answers

Regarding ArrayIndex inside Linq Query

i have LINQ expression node type ArrayIndex is not suported in LINQ to Entities error when i am trying to do the following public List ShowAttachments(int type, int ReferenceId) { try { var attachmentNames = …
bhargav
  • 619
  • 2
  • 14
  • 30
2
votes
0 answers

SQL User-Defined Functions in Linq to Entities

I am trying to call a user defined sql function in my linq statement using entity framework. The function is called GetXml, and takes 2 strings called "data" and "path" and returns a string. My Data Model is called XmlDataModel. I included the…
2
votes
1 answer

Entity Framework and Linq to Entities and .Include() few tables, or maybe

i've got a database with a table named PropertyValues where i store every value i need to describe some properties of my database table rows. For example, table Products which looks like this : ID OrderID //Products table is related with Order…
shkipper
  • 1,403
  • 3
  • 21
  • 35
2
votes
4 answers

Remove from list where all items not included using LINQ

I have a generic list ItemList where if each ListID doesn't contain all possible ItemIDs, then I'd like to remove them from the list. I'll illustrate below with a cut down version of the data: MaxItemID = 4 ListID ItemID 1 …
e-on
  • 1,547
  • 8
  • 32
  • 65
2
votes
2 answers

Can't Translate Extension Method Into Store Expression

I have an extension method as follows: public static bool SatisfiesSomeCondition(this Post post, SomeObj someObj) { return post.SomeObjId == someObj.SomeObjId; } And i'm trying to use it like this: var query = ctx.Posts.Where(p =>…
2
votes
1 answer

How to do a simple OR query with LINQ?

I am using LINQ to Entities and I'm trying to do a simple OR query. I have a table called "Links" and when I run a query I want to include all links containing any tag from a list of tags and all links matching a search term. For example: var tags =…
CatDadCode
  • 58,507
  • 61
  • 212
  • 318
2
votes
1 answer

Get record name from a table that is referenced by ID with LINQ

I encountered a problem, while doing some MVC testing. So at the moment I have 2 tables, one called Leagues and one called Teams. In Leagues I have LeagueID, LeagueName, and in Teams I have TeamID and TeamName. Then I have another table called…
JMon
  • 3,387
  • 16
  • 63
  • 102
2
votes
3 answers

Persisting a Variable across Requests

I realize this may be a simple problem, but I am new to ASP.net (C#) and am having an issue with a method in which I pass a 'Ride' object that was obtained from an sql database through a LINQ-to-entities statement. I attempt to set another global…
SHeinema
  • 634
  • 5
  • 14
  • 34
2
votes
2 answers

Filtering Entity Framework results on SQL Server

First up: we are not doing TPH (table per hierarchy), that would make this a lot simpler. I have about 20 POCOs that all have similar properties in some cases. The similar properties I care about are ___.CreatedDate and ___.UpdatedDate. For some…
Bryan Boettcher
  • 4,412
  • 1
  • 28
  • 49
2
votes
3 answers

LINQ - Summing numbers stored as string

I have the following data: PK OrderNumber USERDEFFIELD 1 0001 10 2 0001 25 3 0002 20 4 0002 22 5 0002 NULL 6 0003 ABC123 The UserDefField…
FMFF
  • 1,652
  • 4
  • 32
  • 62
2
votes
1 answer

LINQ 2 Entities-query is not working, but why?

everyone! )) Here is code. var existingEntities = (from record in globalOne.serviceContext.records_out where record.timestamp.Date == DateTime.Now.Date select record ).ToList(); It doesn't…
Monochromie
  • 439
  • 5
  • 17
2
votes
1 answer

Linq-to-Sql many-to-many

I have a many-to-many query problem in Linq-to-SQL. I have a table named user. User has got 2 products > join product.UserID and Product can be have 2 equipment. Product to Equipments have many to many association I want to get user's…
halit
  • 1,128
  • 1
  • 11
  • 27
2
votes
2 answers

Linq date and datetime comparer

I need to get the query of the day, the problem is that I'm getting an error when I try to compare the value that comes from the DB (which is a DateTime), against the DateTime.Today.Date value. What I'm trying to achieve is to get the registers of…
Luis
  • 5,786
  • 8
  • 43
  • 62
2
votes
2 answers

Are some Funcs impossible to convert to equivalent Expressions?

This is a follow up to a question I asked earlier seen here: Confused about passing Expression vs. Func arguments The accepted answerer there suggests refactoring an Expression referencing local objects into something that Linq to Entities can…
Erix
  • 7,059
  • 2
  • 35
  • 61
2
votes
1 answer

Entity Framework: Many To Many Count and Sum

I am using the Entity Framework. I have a many to many relationship Articles <-> Categories. Each article can belong to many categories, and each category can belong to more than one article. I can get the COUNT of articles within each…
Mike