Browse by Tags

Tagged Content List
  • Blog Post: 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. Review.Stars == 5). Unfortunately though this isn...
  • Blog Post: Tip 28 - How to implement an Eager Loading strategy

    Background: Over the last 2 years lots of people have complained about the way Eager loading works in the Entity Framework, or rather the way you ask the Entity Framework to eagerly load. Here is how you do it: var results = from b in ctx.Blogs.Include(“Posts”) where b.Owner == “Alex” select b; This...
  • Blog Post: Tip 22 - How to make Include really Include

    This is 22nd post in my ongoing series of Entity Framework Tips . If you want to do eager loading with the Entity Framework it is generally really easy, you simply write something like this: var results = from post in ctx.Posts.Include(“Comments”) where post.Author.EmailAddress == “alexj@microsoft...
  • Blog Post: Tip 6 - How and when to use eager loading

    When should you use eager loading? Usually in your application you know what you are going to "do" with an entity once you have retrieved it. For example if you retrieve an order so you can re-print it for a customer, you know that the re-print would be incomplete without information about the items...
Page 1 of 1 (4 items)