31 blog posts tagged LINQ

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.

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.

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.

LINQ to SQL tips and tricks #3
Another set of useful and lesser-known LINQ to SQL techniques.

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.

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).

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 :)

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:

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.

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.

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

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.

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.

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.

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.

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.

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.

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.

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.

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.

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).

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

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.

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.

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.

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:

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.

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.

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…

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).

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.