31 blog posts tagged LINQ

Placeholder image
MAR
2
2021
Development3 minutes

Creating OR expressions in LINQ

As everybody who has read my blog before knows, I love LINQ and miss it when coding in other languages, so it's nice when I get a chance to use it again. When I come back to it with fresh eyes, I notice some things aren't as easy as they should be - and this time is no exception.

Placeholder image
SEP
4
2014
Development3 minutes

Optimizing Sum, Count, Min, Max and Average with LINQ

LINQ is a great tool for C# programmers letting you use familiar syntax with a variety of back-end systems without having to learn another language or paradigm for many query operations.

Placeholder image
MAY
21
2010
Development4 minutes

Include for LINQ to SQL (and maybe other providers)

It’s quite common that when you issue a query you’re going to want to join some additional tables.

Placeholder image
JAN
11
2010
Development5 minutes

LINQ to SQL tips and tricks #3

Another set of useful and lesser-known LINQ to SQL techniques.

A query plan in SQL Management Studio
DEC
13
2009
Development2 minutes

SQL Server query plan cache – what is it and why should you care?

SQL Server like all databases goes through a number of steps when it receives a command. Besides parsing and validating the command text and parameters it looks at the database schema, statistics and indexes to come up with a plan to efficiently query or change your data.

Placeholder image
NOV
6
2009
Development8 minutes

Multiple outputs from T4 made easy – revisited

My multiple outputs from t4 made easy post contained a class making it easy to produce multiple files from Visual Studio’s text templating engine (T4).

Thumbnail of the LINQ to SQL Cheat Sheet PDF
AUG
12
2009
Development1 minutes

LINQ to SQL cheat sheet

A few short words to say I’ve put together a cheat sheet for LINQ to SQL with one page for C# and another for VB.NET.

It shows the syntax for a number of common query operations, manipulations and attributes and can be a very useful quick reference :)

Placeholder image
JUN
24
2009
Development6 minutes

Client-side properties and any remote LINQ provider

David Fowler on the ASP.NET team and I have been bouncing ideas about how to solve an annoyance using LINQ:

Placeholder image
JUN
4
2009
Development4 minutes

LINQ to SQL resources

A quick round-up of some useful LINQ to SQL related resources that are available for developers. I’ve not used everything on this list myself so don’t take this as personal endorsement.

Placeholder image
JUN
1
2009
Development4 minutes

LINQ to SQL changes in .NET 4.0

People have been asking via Twitter and the LINQ to SQL forums so here’s a list I put together on a number of the changes made for 4.0.

Placeholder image
APR
12
2009
Development3 minutes

LINQ to SQL tips and tricks #2

A few more useful and lesser-known tips for using LINQ to SQL.

Placeholder image
MAR
16
2009
Development3 minutes

LINQ to SQL tips and tricks #1

Being on the inside of a product team often leads to uncovering or stumbling upon lesser-known techniques, and here are a few little nuggets I found interesting – I have more if there is interest.

Placeholder image
JAN
19
2009
Development1 minutes

LINQ to SQL templates updated, now on CodePlex

My templates that allow you to customize the LINQ to SQL code-generation process (normally performed by SQLMetal/LINQ to SQL classes designer) have been updated once again.

State Pattern class diagram
JAN
5
2009
Development5 minutes

Changing type, the state pattern and LINQ to SQL

A question I see from time-to-time on LINQ to SQL relates to changing an entity’s class.

Placeholder image
OCT
31
2008
Development3 minutes

LINQ to SQL next steps

There has been a flurry of posts and comments in the last 24 hours over the future of LINQ to SQL so I thought it would be interesting to provide some information on what the LINQ to SQL team have been up to and what we’re working on for .NET Framework 4.0.

Placeholder image
SEP
14
2008
Development5 minutes

LINQ to SQL template for Visual Studio 2008

A newer version of this LINQ to SQL template is available.

If you want to customize the LINQ to SQL code generation phase in your project without additional tool dependencies this could be what you’re looking for.

Placeholder image
JUL
30
2008
Development4 minutes

LINQ to SQL log to debug window, file, memory or multiple writers

The Log property on a LINQ to SQL data context takes a TextWriter and streams out details of the SQL statements and parameters that are being generated and sent to the server.

Placeholder image
JUL
23
2008
Development2 minutes

LINQ to SQL T4 template reloaded

The topic of modifying the code generation phase of LINQ to SQL comes up quite often and the limited T4 template I published here last month was good at showing the potential but wasn’t a practical replacement for the code generation phase.

Placeholder image
JUN
25
2008
Development2 minutes

Experimental LINQ to SQL template

A newer version of this LINQ to SQL template is available

While SQLMetal does a good job of turning your SQL schema into a set of classes for you it doesn’t let you customize the code generation process.

Placeholder image
APR
10
2008
Development1 minutes

Using LINQ to foreach over an enum in C#

I later expanded this out into a full Enum<T> strongly typed helper.

I can’t be the only person in the world who wants to foreach over the values of an enum otherwise Enum.GetValues(Type enumType) wouldn’t exist in the framework. Alas it didn’t get any generics love in .NET 2.0 and unhelpfully returns an array.

Placeholder image
APR
1
2008
Personal2 minutes

Joining the LINQ to SQL team at Microsoft

I’ve been quiet on my blog lately largely because I have been preparing to change job and relocate half-way around the world to Vancouver in the beautiful province of British Columbia (where I spent my 2004 summer holiday).

Placeholder image
JAN
29
2008
Development1 minutes

Language Integrated Query: An introduction presentation online

This evening’s presentation on Language Integrated Query (LINQ) is now available from my appearances page.

Placeholder image
JAN
28
2008
Development1 minutes

Language Integrated Query: An introduction talk tomorrow

I’m just finishing up the slides, notes and writing code samples for my LINQ presentation at the Guernsey Software Developer Forum tomorrow evening.

Placeholder image
JAN
5
2008
Development1 minutes

LINQ presentation at Guernsey Developer Forum

I will be giving a talk at the Guernsey Software Developer Forum at the end of the month on Microsoft’s new Language Integrated Query (LINQ) with particular emphasis on the capabilities and object-relational mapping characteristics of LINQ to SQL.

Placeholder image
SEP
3
2007
Development2 minutes

LINQ in 60 seconds

Microsoft’s Language INtegrated Query (LINQ) aims to provide a way of selecting objects with a common syntax independent of the data source.

Placeholder image
AUG
2
2007
Development3 minutes

Partial methods in .NET 3.5, overview and evolution

One of the interesting new things in .NET 3.5 is partial methods which are now being used extensively by LINQ to SQL and no-doubt will be Microsoft’s corner-post of extensibility for generated classes. Here’s a quick overview:

Placeholder image
JUN
26
2007
Development6 minutes

CodeSmith template to generate LINQ To SQL Data Context

If you are interested in what LINQ to SQL generates and don’t have Orcas installed or available right now but use CodeSmith try the following template to generate very similar code.

Placeholder image
JUN
20
2007
Development2 minutes

Discarding new entity objects in LINQ to SQL beta 1

An unusual bug in .NET Framework 3.5 beta 1 that relates to creating a new entity object in LINQ to SQL has been getting in my way.

Placeholder image
JUN
11
2007
Development1 minutes

LINQ to SQL NullReferenceException on SubmitChanges

I’ve been busy working on some LINQ to SQL (formerly DLINQ) apps that have been going well bar a NullReferenceException thrown at me from deep in the bowels of LINQ and it’s change tracker. A cursory glance in debug showed none of the properties that represent columns were null…

Placeholder image
MAY
16
2007
Development4 minutes

LINQ to SQL details, issues and patterns

LINQ to SQL (formerly called DLINQ) is a simple object-relational mapper (ORM) scheduled for .NET Framework 3.5/Visual Studio 2007 (Orcas).

Window of the LINQ To SQL templates available
JAN
6
2007
Development1 minutes

LINQ in C# Web Applications

I’m a big fan of the Web Application type that was previously available as an add-on to Visual Studio 2005 but thankfully got promoted to a standard citizen with Service Pack 1.