82
1
// Entity Framework Plus
2
// Doc: https://entityframework-plus.net/query-include-filter
3
4
// @nuget: EntityFramework
5
// @nuget: Z.EntityFramework.Plus.EF6
6
7
using System;
8
using System.Linq;
9
using System.Data.Entity;
10
using System.Collections.Generic;
11
using Z.EntityFramework.Plus;
12
13
public class Program
14
{
15
public static void Main()
16
{
17
GenerateData();
18
19
// Update: UPDATE all rows from the database using a LINQ Query without loading entities in the context.
20
using (var context = new EntityContext())
21
{
22
// LOAD orders and the first 10 active related entities.
23
var list = context.Orders.Where(o => !o.IsSoftDeleted).IncludeFilter(o => o.Items.Where(y => !y.IsSoftDeleted)
24
.OrderBy(y => y.Date)
Cached Result
Product: Laptop, Category: Electronics, Price: $1,200.00, Stock: 10