in

 

Browse by Tags

  • Deferred execution gotchas

    I was trying to be clever the other day and try to chain assertions on an array: [ Test ] public void This_does_not_work() { var items = new [] {1, 2, 3, 4, 5}; items .Each(x => x.ShouldBeLessThan(0)) .Each(x => x.ShouldBeGreaterThan(10)); } I did this by writing an Each extension method that I've...
    Posted to Jimmy Bogard (Weblog) by bogardj on 08-13-2008
  • Query Objects with Repository Pattern Part 2

    As promised in my previous post , I’m going to make our query object a little more flexible and dynamic. First, this is what I really want to be able to do something like this: var customers = repo.FindBy( new TopCustomersWithLowDiscountQuery() .IncludePreferred() .BelowDiscountThreshold(3) .WithMoreSalesThan...
    Posted to Chad Myers' Blog (Weblog) by chadmyers on 08-02-2008
  • Query Objects with the Repository Pattern

    Nate Kohari (whose primate brain is far too small to comprehend this post [inside joke, he’s actually really sharp]) was asking on Twitter today about how to structure his repositories: Per aggregate root, Per entity, or just one repository for everything? The two suggestions that rose to the top were...
    Posted to Chad Myers' Blog (Weblog) by chadmyers on 08-01-2008
  • Expressions and Lambdas

    Some conversation on a recent post on Chad's blog brought up the confusion between Lambdas and Expressions. A while back, I went into the various ways to create delegates throughout the different versions of C#. Although I touched on it briefly, the slight variations in the different lambda types...
    Posted to Jimmy Bogard (Weblog) by bogardj on 07-18-2008
  • Some improved LINQ operators

    I ran across a couple of scenarios the other day that were made pretty difficult given the current LINQ query operators. First, I needed to see if an item existed in a collection. That's easy with the Contains method, when you want to find item that matches all the attributes you're looking for...
    Posted to Jimmy Bogard (Weblog) by bogardj on 06-07-2008
  • LINQ query operators: lose that foreach already!

    Now that .NET 3.5 is out with all its LINQ query operator goodness, I feel like going on a mean streak of trashing a lot of our (now) pointless foreach loops. Some example operations include: Transformations Aggregations Concatenations Filtering As I mentioned in my last post , temporary list creation...
    Posted to Jimmy Bogard (Weblog) by bogardj on 05-09-2008
  • Enhancing mappers with LINQ

    The "big 3" higher-order functions in functional programming are Filter, Map and Reduce. When looking at the new C# 3.0 LINQ query operators, we find that all three have equivalents : Filter = Where Map = Select Reduce = Aggregate Whenever you find yourself needing one of these three higher...
    Posted to Jimmy Bogard (Weblog) by bogardj on 05-08-2008
Page 1 of 1 (7 items)
Copyright Los Techies 2007. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems