Linq to Sql

There are 2 entries for the tag Linq to Sql

Converting Sql to Linq

Sometimes I know how to do something in Sql but not how to do the same thing in Linq.  I think this is a common scenario until we all start thinking in Linq. Here is an example of some Sql that I struggled to translate into Linq SELECT ResourceTag.ResourceId,                  CourseResource.Name,                  CourseResource.FileUri,                  CourseResource.Active FROM ResourceTag                          INNER JOIN ...

Linq to SQL Nulls

The way Linq to Sql deals with nulls had me scratching my head initially.  At first things seemed simple - for example the following does exactly what you would expect (Mike Taulty goes into more details on why here): Customers.Where(c => c.Region==null) This resolves to the following SQL: SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address],        [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax] FROM [Customers] AS [t0] WHERE [t0].[Region] IS NULL Notice that the Where clause uses IS NULL rather than = null which is correct.  However if I pass a null parameter to the query then the SQL is resolved incorrectly.  For example: string region=null; Customers.Where (c => c.Region==region); This...

«March»
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910