tags

lambda

Little known new features in Visual Studio 2012

Visual Studio 2012 RC is out since last week, and even though I didn’t have much time to play with it yet, I think I like it so far. Lots of things have already been said about the design, and about the most important new features, but there are also many smaller and less remarkable improvements that make life easier for us. Since I have seen little or nothing written about those, I thought I would make a list of what I noticed so far.

[Entity Framework] Using Include with lambda expressions

I’m currently working on a project that uses Entity Framework 4. Even though lazy loading is enabled, I often use the ObjectQuery.Include method to eagerly load associated entities, in order to avoid database roundtrips when I access them: var query = from ord in db.Orders.Include("OrderDetails") where ord.Date >= DateTime.Today select ord; Or if I also want to eagerly load the product: var query = from ord in db.Orders.Include("OrderDetails.Product") where ord.Date >= DateTime.