Chris Stuff
Categories
-
Recent Posts
Recent Comments
Archives
- February 2013
- January 2013
- December 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- December 2011
- May 2011
- March 2011
- December 2010
- August 2010
- May 2010
- March 2010
- February 2010
- January 2010
- December 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- January 2009
Category Archives: LINQ
Thinking Linq
I’ve been comfortable using LINQ for what seems like a long time. I’m noticing that I’ve been implementing some of the lesser used functions a bit more as of late, but I’m not sure exactly when they’re appropriate. Take the … Continue reading
Queue is Always Empty Using yield return
I ran into an issue in a C# application the other day. Thankfully I figured out what was going wrong right away, but it could have turned into a big headache potentially. Post Footer automatically generated by Add Post Footer … Continue reading
Also posted in ASP.NET MVC
2 Comments
Autoprojecting LINQ queries
Something I’ve been looking at adding to AutoMapper was the idea of doing automatic query projection in the Select query projection in LINQ statements. One downside of AutoMapper is that projection from domain objects still forces the entire domain object … Continue reading
What is Projection?
I think there’s great benefit in not only knowing how to design your code to use common patterns but also to be able to speak about them clearly and concisely to others. If I mention that the problem sounds like … Continue reading
Also posted in Communication, Reading Code
10 Comments
Implementing Domain Queries
My current Repository interface looks something like this: public interface IRepository { T FindOne<T>(int id); T FindBy<T>(Expression<Func<T, bool>> expression); IEnumerable<T> FindAllBy<T>(Expression<Func<T, bool>> expression); IEnumerable<T> FindAll<T>(); T FindOneBy<T>(Expression<Func<T, bool>> expression); void Save<T>(T target); void Update<T>(T target); void SaveOrUpdate<T>(T target); void Delete<T>(T … Continue reading
Also posted in Communication, Reading Code
10 Comments
Selecting Static Results with Dynamic LINQ
Dynamic LINQ (DLINQ) is a LINQ extension provided in the VS 2008 Samples. Scott Guthrie provides a good overview here: Dynamic LINQ (Part 1: Using the LINQ Dynamic Query Library), but the executive summary is that it implements certain query … Continue reading
Also posted in Best Practices, Design Principles, Legacy Code, Testing
8 Comments
LINQ query operators and null lists
One of my pet peeves with the LINQ extension methods is their inability to handle null source lists. For example, this will throw an ArgumentNullException: [Test] public void Should_handle_nulls() { List<int> ints = null; ints.Any(num => num < 0).ShouldBeFalse(); } … Continue reading
More missing LINQ operators
Continuing an old post on missing LINQ operators, the wonders of extension methods allow us as developers to fill potential holes in LINQ operators. Whether it’s a Zip method (now included in .NET 4.0), or better methods for IComparer-based operators, … Continue reading
Also posted in Best Practices, Continuous Integration, Deployment, SOLID, Testing
Tagged collective code ownership, continuous deployment, continuous integration, links, refactoring, testing
Leave a comment
Hacking LINQ Expressions: Join With Comparer
In this installment of my Hacking LINQ series we’ll take a look at providing an IEqualityComparer for use in a LINQ join clause. The Problem Many of the Standard Query Operators require comparing sequence elements and the default query providers … Continue reading
Also posted in For Fun, Testing
6 Comments
Hacking LINQ Expressions: Select With Index
First, a point of clarification: I use LINQ Expressions to mean (Language-INtegrated) Query Expressions (the language feature) rather than Expression Trees (the .NET 3.5 library in System.Linq.Expressions). So what do I mean by “Hacking LINQ Expressions”? Quite simply, I’m not … Continue reading

