Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Linq to Objects   (RSS)
Tip 37 – How to do a Conditional Include
Problem Someone asked how to do a Conditional Include a couple of days ago on StackOverflow. They wanted to query for some entity (lets say Movies) and eager load some related items (lets say Reviews) but only if the reviews match some criteria (i.e. Read More...
Tip 35 – How to write OfTypeOnly<TEntity>()
If you write a LINQ to Entities query like this: var results = from c in ctx.Vehicles.OfType<Car>() select c; It will bring back, Cars and any type that derives from Car, like say SportCar or SUV. If you just want Cars and you don’t want derived Read More...
Tip 31 – How to compose L2O and L2E queries
Imagine you want to write a query like this: var possibleBuyers= from p in ctx.People where p.Address.City == “Sammamish” && InMarketForAHouse(p) select p; Now theoretically this is possible so long as there is a SQL translation for InMarketForAHouse. Read More...
Page view tracker