Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️ Using Include() is super… | 20 comments (2024)

Dave Callan

Microsoft MVP | Senior Software Engineer | .NET Content Creator

  • Report this post

Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super common to eager load our child navigation collections, it's default usage however could potentially result in a lot of unnecessary data coming back, particularly in systems which deal with large volumes of data. Thankfully Entity Framework allows us to filter (and sort) our Includes() as the simple example below shows ...Do you use filtered Includes() much?

  • Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (2)

337

20 Comments

Like Comment

Dave Callan

Microsoft MVP | Senior Software Engineer | .NET Content Creator

6d

  • Report this comment

Reposts appreciated to help support my content 😊

Like Reply

1Reaction

Sebastian Pinski

Software Development Manager - Financial Systems at Amazon Prime Video

6d

  • Report this comment

Not sure what the “Where” is doing in this example.

Like Reply

2Reactions 3Reactions

Allen Huber

16-year .NET developer (Blazor, UWP, MAUI, Windows Forms) on the verge of giving up | **Improving at** Web API, MVC, and WinApp SDK/WinUI3 | devblog.allenhuber.com/blog

6d

  • Report this comment

I don't use Entity Framework professionally but dabble on the side just to maintain a little hands-on. Based on my notes, I had never used this before, so I've learned something new! 👍

Like Reply

1Reaction 2Reactions

Kirill T.

Senior Software Engineer | .NET Core & Java Expert | Microservices & Scalable Systems | Driving Innovation in Tampa Bay’s Tech Industry

6d

  • Report this comment

Depends on project. Sometimes lazy loading is more comfortable. But not good idea for performance improvement. EF is useful tool but it requires some experience. Lately I’ve been using Dapper and gRPC instead of REST more often. One more time it always depends.

Like Reply

2Reactions 3Reactions

Manoj Jadhav

Senior Software Developer @ Weatherford | C# .Net Angular WCF WPF | SQL |EF| High Level and Low Level Design | System Design Principal | Database Design Principal | Agile Development | Micro-service architecture

6d

  • Report this comment

Dave Callan thanks for the sharing.how was the permanence in numbers if you can include will be helpful?

Like Reply

1Reaction 2Reactions

Kais Alar

Software Engineer | Backend Developer | .NET Core | C#

2d

  • Report this comment

Thanks a lot for sharing, but what about nested includes?

Like Reply

1Reaction

Poorna Soysa

Tech Enthusiast | .Net | C# | Azure | AWS

6d

  • Report this comment

I use. Nice feature. Thanks for sharing Dave

Like Reply

1Reaction 2Reactions

Nuno Figueira

Senior Software Engineer | Linux | Firmware Developer | Team player

6d

  • Report this comment

The first time I use include property was in EF7, just because this version apparently does not include by default some related entities... In my case on methods First, Find, Select...For exempla,BankAcount{Address,Contacts}Adress {}Contacts {}

Like Reply

1Reaction 2Reactions

Miguel Parra

Fullstack | .Net | SQL Server | Angular | HTML | CSS | Javascript | Microsserviços | RabbitMQ | Azure | DevOps | Redis | Ágil | SQL | API | REST | GIT | Entity Framework | C# | Docker | Espanhol | Inglês | Freelance

4d

  • Report this comment

Thanks for sharing

Like Reply

1Reaction

Philip Kayode, PHILSKAY

Self-taught .NET Engineer| Helping you simplify complex and advanced .NET applications| .NET Core| C#| Blazor

6d

  • Report this comment

Very helpful post

Like Reply

1Reaction 2Reactions

See more comments

To view or add a comment, sign in

More Relevant Posts

  • Dave Callan

    Microsoft MVP | Senior Software Engineer | .NET Content Creator

    • Report this post

    𝗛𝘁𝗺𝗹𝗘𝗻𝗰𝗼𝗱𝗲 & 𝗨𝗿𝗹𝗘𝗻𝗰𝗼𝗱𝗲 𝗽𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲 𝗶𝗺𝗽𝗿𝗼𝘃𝗲𝗺𝗲𝗻𝘁𝘀 in .𝗡𝗘𝗧 𝟵 🚀Performance guru Stephen Toub is working his magic again, this time improving the performance of HtmlEncode & UrlEncode. Going by the PR, it looks like he uses a variety of techniques including utilizing SearchValues which was new in .NET 8.Some of his benchmark timings below ...

    • Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (17)

    27

    2 Comments

    Like Comment

    To view or add a comment, sign in

  • Dave Callan

    Microsoft MVP | Senior Software Engineer | .NET Content Creator

    • Report this post

    𝗘𝘅𝗽𝗹𝗼𝗿𝗶𝗻𝗴 𝗖# 𝟭𝟮 𝗳𝗲𝗮𝘁𝘂𝗿𝗲𝘀 blog series 💡 Really enjoyed this four part series from David Pine on the main MS devblogs site which looks at how we might apply some of the new features of C# 12 such as primary constructors and collection expressions to our codebases. 𝗥𝗲𝗳𝗮𝗰𝘁𝗼𝗿 𝘆𝗼𝘂𝗿 𝗖# 𝗰𝗼𝗱𝗲 𝘄𝗶𝘁𝗵 𝗽𝗿𝗶𝗺𝗮𝗿𝘆 𝗰𝗼𝗻𝘀𝘁𝗿𝘂𝗰𝘁𝗼𝗿𝘀https://lnkd.in/eAqBaDeR𝗥𝗲𝗳𝗮𝗰𝘁𝗼𝗿 𝘆𝗼𝘂𝗿 𝗖# 𝗰𝗼𝗱𝗲 𝘄𝗶𝘁𝗵 𝗰𝗼𝗹𝗹𝗲𝗰𝘁𝗶𝗼𝗻 𝗲𝘅𝗽𝗿𝗲𝘀𝘀𝗶𝗼𝗻𝘀https://lnkd.in/eNGf82Ft𝗥𝗲𝗳𝗮𝗰𝘁𝗼𝗿 𝘆𝗼𝘂𝗿 𝗖# 𝗰𝗼𝗱𝗲 𝗯𝘆 𝗮𝗹𝗶𝗮𝘀𝗶𝗻𝗴 𝗮𝗻𝘆 𝘁𝘆𝗽𝗲https://lnkd.in/eat-ReJp𝗥𝗲𝗳𝗮𝗰𝘁𝗼𝗿 𝘆𝗼𝘂𝗿 𝗰𝗼𝗱𝗲 𝘄𝗶𝘁𝗵 𝗱𝗲𝗳𝗮𝘂𝗹𝘁 𝗹𝗮𝗺𝗯𝗱𝗮 𝗽𝗮𝗿𝗮𝗺𝗲𝘁𝗲𝗿𝘀https://lnkd.in/eqCiUCndWell worth a read 👍🏻

    • Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (22)

    134

    14 Comments

    Like Comment

    To view or add a comment, sign in

  • Dave Callan

    Microsoft MVP | Senior Software Engineer | .NET Content Creator

    • Report this post

    .NET 8 new static code analyzers 💡I'm a big fan of using tooling where possible to help us improve our code and these new analyzers added in .NET 8 should help. Note ... CA1864 is not shown below but was also added in .NET 8 and catches occurrences of a Dictionary.Add call guarded by Dictionary.ContainsKey.Which ones will you turn on?

    • Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (27)

    116

    7 Comments

    Like Comment

    To view or add a comment, sign in

  • Dave Callan

    Microsoft MVP | Senior Software Engineer | .NET Content Creator

    • Report this post

    𝗥𝗲𝗮𝗱𝗢𝗻𝗹𝘆𝗦𝗲𝘁<𝗧> coming in .NET 9 💡We already have ReadOnlyCollection<T> and ReadOnlyDictionary<TKey, TValue> but no ReadOnlySet<T>. A PR has been merged for this and I'd expect it to be released with .NET 9 Preview 6 in the 2nd or 3rd week of July.

    • Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (32)

    112

    17 Comments

    Like Comment

    To view or add a comment, sign in

  • Dave Callan

    Microsoft MVP | Senior Software Engineer | .NET Content Creator

    • Report this post

    Welcome to .NET Aspire YouTube playlist ⬇️Intro to Aspire playlist, great if you haven't looked into Aspire much yet. Playlist Link -> https://lnkd.in/eN7TFhJb

    • Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (37)

    157

    9 Comments

    Like Comment

    To view or add a comment, sign in

  • Dave Callan

    Microsoft MVP | Senior Software Engineer | .NET Content Creator

    • Report this post

    𝗚𝗲𝗻𝗲𝗿𝗶𝗰 𝗢𝗿𝗱𝗲𝗿𝗲𝗱𝗗𝗶𝗰𝘁𝗶𝗼𝗻𝗮𝗿𝘆 coming in .NET 9 🔥.NET does not currently have a genericOrderedDictionaryclass which has meant many of us have rolled own our solutions. Thankfully a PR adding a generic OrderedDictionary was merged two days ago and should be released with preview 6. This is awesome and should allow many of us to remove custom code and get the best performance from the built in implementation.

    • Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (42)

    364

    25 Comments

    Like Comment

    To view or add a comment, sign in

  • Dave Callan

    Microsoft MVP | Senior Software Engineer | .NET Content Creator

    • Report this post

    Recommended Entity Framework YouTube playlist 💡Milan Jovanović has covered a lot of Entity Framework content on his YouTube channel over the last year, so much quality content here. Check it out -> https://lnkd.in/eHfMhEfk

    • Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (47)

    168

    12 Comments

    Like Comment

    To view or add a comment, sign in

  • Dave Callan

    Microsoft MVP | Senior Software Engineer | .NET Content Creator

    • Report this post

    .NET 9 optimized static web asset delivery with new middleware 💡In .NET 9 (Preview 5+) 𝗠𝗮𝗽𝗦𝘁𝗮𝘁𝗶𝗰𝗔𝘀𝘀𝗲𝘁𝘀 is a new middleware that helps optimize the delivery of static assets in an app. It works with all UI frameworks, including Blazor, Razor Pages, and MVC. MapStaticAssetsoperates by combining build and publish-time processes to collect information about all the static resources in an app. This information is then utilized by the runtime library to efficiently serve these files to the browser by utilizing techniques such as 𝗯𝘂𝗶𝗹𝗱 𝘁𝗶𝗺𝗲 𝗴𝘇𝗶𝗽 𝗮𝗻𝗱 𝗯𝗿𝗼𝘁𝗹𝗶 𝗰𝗼𝗺𝗽𝗿𝗲𝘀𝘀𝗶𝗼𝗻.The image below (from MS) shows the original and compressed sizes of the CSS and JS files in the default Razor Pages template.What do you think?

    • Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (52)

    171

    15 Comments

    Like Comment

    To view or add a comment, sign in

Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (56)

Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️Using Include() is super… | 20 comments (57)

55,275 followers

  • 1,566 Posts
  • 23 Articles

View Profile

Follow

More from this author

  • eShopOnWeb Architecture (16/16) - uses clean architecture Dave Callan 2y
  • eShopOnWeb Architecture (15/16) – has a really nice example of the Interface Segregation Principle Dave Callan 2y
  • eShopOnWeb Architecture (14/16) – uses parameterized tests Dave Callan 2y

Explore topics

  • Sales
  • Marketing
  • Business Administration
  • HR Management
  • Content Management
  • Engineering
  • Soft Skills
  • See All
Dave Callan on LinkedIn: Entity Framework FILTERED INCLUDE() example ⬇️

Using Include() is super… | 20 comments (2024)
Top Articles
Latest Posts
Article information

Author: Annamae Dooley

Last Updated:

Views: 6044

Rating: 4.4 / 5 (65 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Annamae Dooley

Birthday: 2001-07-26

Address: 9687 Tambra Meadow, Bradleyhaven, TN 53219

Phone: +9316045904039

Job: Future Coordinator

Hobby: Archery, Couponing, Poi, Kite flying, Knitting, Rappelling, Baseball

Introduction: My name is Annamae Dooley, I am a witty, quaint, lovely, clever, rich, sparkling, powerful person who loves writing and wants to share my knowledge and understanding with you.