diff --git a/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/.gitignore b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/.gitignore
new file mode 100644
index 0000000..3e1f0e7
--- /dev/null
+++ b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/contentModel.xml
+/.idea.WorkingWithEFCore.iml
+/modules.xml
+/projectSettingsUpdater.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/aws.xml b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/aws.xml
new file mode 100644
index 0000000..b63b642
--- /dev/null
+++ b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/aws.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/dataSources.xml b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/dataSources.xml
new file mode 100644
index 0000000..c9aff58
--- /dev/null
+++ b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/dataSources.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ sqlserver.ms
+ true
+ com.microsoft.sqlserver.jdbc.SQLServerDriver
+ jdbc:sqlserver://localhost
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/encodings.xml b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/encodings.xml
new file mode 100644
index 0000000..df87cf9
--- /dev/null
+++ b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/indexLayout.xml b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/vcs.xml b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/vcs.xml
new file mode 100644
index 0000000..b2bdec2
--- /dev/null
+++ b/Chapter10/WorkingWithEFCore/.idea/.idea.WorkingWithEFCore/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Chapter10/WorkingWithEFCore/WorkingWithEFCore/Program.cs b/Chapter10/WorkingWithEFCore/WorkingWithEFCore/Program.cs
index ff3ad4a..5a9b01b 100644
--- a/Chapter10/WorkingWithEFCore/WorkingWithEFCore/Program.cs
+++ b/Chapter10/WorkingWithEFCore/WorkingWithEFCore/Program.cs
@@ -3,6 +3,7 @@ using Packt.Shared;
Console.WriteLine($"Using {ProjectConstants.DatabaseProvider} database provider.");
QueryingCategories();
+FilteredIncludes();
static void QueryingCategories()
{
@@ -23,4 +24,30 @@ static void QueryingCategories()
Console.WriteLine($"{c.CategoryName} has {c.Products.Count} products");
}
}
+}
+
+static void FilteredIncludes()
+{
+ using (Northwind db = new())
+ {
+ Console.Write("Enter a minimum for units in stock: ");
+ string unitsInStock = Console.ReadLine() ?? "10";
+ int stock = int.Parse(unitsInStock);
+ IQueryable? categories = db.Categories?
+ .Include(c => c.Products.Where(p => p.Stock >= stock));
+ if (categories is null)
+ {
+ Console.WriteLine("No categories found.");
+ return;
+ }
+
+ foreach (Category c in categories)
+ {
+ Console.WriteLine($"{c.CategoryName} has {c.Products.Count} products with a minimum of {stock} units in stock.");
+ foreach (Product p in c.Products)
+ {
+ Console.WriteLine($" {p.ProductName} has {p.Stock} units in stock.");
+ }
+ }
+ }
}
\ No newline at end of file