tagged [linq-to-sql]

How can I conditionally apply a Linq operator?

How can I conditionally apply a Linq operator? We're working on a Log Viewer. The use will have the option to filter by user, severity, etc. In the Sql days I'd add to the query string, but I want to ...

1 Jul at 09:40

Get table-data from table-name in LINQ DataContext

Get table-data from table-name in LINQ DataContext I need to get table data from table name from Linq DataContext. Instead of this I need to do something like this. It could be any table name that is ...

8 Jul at 15:54

Difference Between Select and SelectMany

Difference Between Select and SelectMany I've been searching the difference between `Select` and `SelectMany` but I haven't been able to find a suitable answer. I need to learn the difference when usi...

24 Nov at 23:47

How to Remove multiple items in List using RemoveAll on condition?

How to Remove multiple items in List using RemoveAll on condition? I tried like following. Instead how can I do something like:

16 Jul at 13:45

LINQ and pagination

LINQ and pagination We need to fetch data from a database using LINQ. We now need to implement pagination. I suppose at a time we need to fetch `10` records at a time and when we click the Next button...

15 Aug at 06:11

FirstorDefault() causes lazy loading or eager loading for linq to sql

FirstorDefault() causes lazy loading or eager loading for linq to sql What is default behavior of FirstOrDefault() when used with Linq to SQL? For e.g

31 May at 14:50

Linq-to-SQL DataContext across multiple threads

Linq-to-SQL DataContext across multiple threads How do I handle a Linq-to_SQL DataContext across multiple threads? Should I be creating a global static DataContext that all the threads use and commit ...

7 Feb at 06:29

How do you group by multiple columns in LINQ TO SQL?

How do you group by multiple columns in LINQ TO SQL? How do you group by multiple columns in LINQ TO SQL? It seems ugly and with poor performance, and I don't even know if it works. Which is the right...

10 Jul at 14:23

How to inner join tables from different Data Context?

How to inner join tables from different Data Context? I have two tables from two different Data Contexts. Although both tables are from the same database, two separate datacontexts exist. Error messa...

4 Mar at 05:33

Cast string as Guid using LinqPad

Cast string as Guid using LinqPad When I run following in the LinqPad it gives me > Cannot implicitly convert type 'string' to 'System.Guid' I just don't know how to apply proper cast it to GUid I gue...

15 Jun at 19:4

Best way to update LINQ to SQL classes after database schema change

Best way to update LINQ to SQL classes after database schema change I'm using LINQ to SQL classes in a project where the database design is still in a bit of flux. Is there an easy way of synchronisin...

2 Sep at 16:54

Exceptions by DataContext

Exceptions by DataContext I've been doing some searching on the internet, but I can't seem to find the awnser. What exceptions can a DataContext throw? Or to be more specific, what exceptions does the...

linq to sql loadwith vs associatewith

linq to sql loadwith vs associatewith what is the difference between loadwith and associatewith. From the articles i read it seems that loadwith is used to load addition data (eg all orders for the cu...

22 May at 16:17

Pluralize English words Like LINQ to SQL Does

Pluralize English words Like LINQ to SQL Does > [Pluralize - Singularize](https://stackoverflow.com/questions/475705/pluralize-singularize) The C# 4.0 (maybe older versions, but I've only tested wit...

23 May at 11:44

Linq distinct & max

Linq distinct & max I have to query this table: I need for all distinct value. How do I have to write my linq query? Thanks in advance,

18 Apr at 07:24

What is the syntax for an inner join in LINQ to SQL?

What is the syntax for an inner join in LINQ to SQL? I'm writing a LINQ to SQL statement, and I'm after the standard syntax for a normal inner join with an `ON` clause in C#. How do you represent the ...

21 Aug at 10:31

LINQ to SQL value BETWEEN two double values

LINQ to SQL value BETWEEN two double values I'm using LINQ to SQL to query my database, I have a query very similar to this: I need the where clause to have a `d.Proce >= minValue`, and `d.Price =

12 Sep at 11:43

Linq IN Operator

Linq IN Operator I've tried searching for this but couldn't find examples that suited my situation. I have this method for returning customers. How can I use the string array of codes to filter it? Co...

15 Sep at 08:2

Way to view SQL executed by LINQ in Visual Studio?

Way to view SQL executed by LINQ in Visual Studio? > [view sql that linq-to-sql produces](https://stackoverflow.com/questions/1235758/view-sql-that-linq-to-sql-produces) I'm wondering if there is a ...

LINQ can't use string.contains?

LINQ can't use string.contains? This is my code: but I get: > Only arguments that can be evaluated on the client are supported for the String.Co

TransactionScope vs Transaction in LINQ to SQL

TransactionScope vs Transaction in LINQ to SQL What are the differences between the classic transaction pattern in LINQ to SQL like: ``` using(var context = Domain.Instance.GetContext()) { try { ...

8 Nov at 17:22

linq to sql recursive query

linq to sql recursive query just using this table, how can a linq query (using linq to sql) be written to fetch the parent data recursively. For instance if the Employer Id selected is 4 it should giv...

1 Nov at 19:0

Select case in LINQ

Select case in LINQ how can I translate this into LINQ? Thank you!

19 May at 11:41

How do I cast a List<T> effectively?

How do I cast a List effectively? I have a but I need a Is there a way to cast this in c#? Or use Linq to get same result? I have two classes that implement the same interface: This List comes from a ...

2 Feb at 21:6

Case insensitive group on multiple columns

Case insensitive group on multiple columns Is there anyway to do a LINQ2SQL query doing something similar to this: or but with ignoring the case

1 Mar at 12:43