C# 6 and .NET Core 1.0Modern Cross-Platform Development by 2016

C# 6 and .NET Core 1.0Modern Cross-Platform Development by 2016

Author:2016
Language: eng
Format: epub, mobi
Publisher: Packt Publishing


This is due to a feature of EF known as lazy loading.

Uncomment the logging line and rerun the application. You will notice that when the code accesses the Products property, EF automatically checks to see whether they are loaded. If not, EF loads them for us "lazily."

For example, just before outputting the count of seafood products, this query is executed:

SELECT [Extent1].[ProductID] AS [ProductID], [Extent1].[ProductName] AS [ProductName], [Extent1].[SupplierID] AS [SupplierID], [Extent1].[CategoryID] AS [CategoryID], [Extent1].[QuantityPerUnit] AS [QuantityPerUnit], [Extent1].[UnitPrice] AS [UnitPrice], [Extent1].[UnitsInStock] AS [UnitsInStock], [Extent1].[UnitsOnOrder] AS [UnitsOnOrder], [Extent1].[ReorderLevel] AS [ReorderLevel], [Extent1].[Discontinued] AS [Discontinued] FROM [dbo].[Products] AS [Extent1] WHERE [Extent1].[CategoryID] = @EntityKeyValue1 -- EntityKeyValue1: '8' (Type = Int32, IsNullable = false) -- Executing at 30/08/2015 14:16:26 +01:00 -- Completed in 0 ms with result: SqlDataReader Seafood has 12 products.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.