Wednesday, June 18, 2014

Expanding the Results View Will Enumerate the IEnumerable Using DB Context

This article describes the most frequent terms confronted by software geeks during LINQ execution. Let's understand the term “results view will enumerate the ienumerable”. Initially it may be slightly confusing for those who are new to LINQ and DB Context terminology but after this demonstration they may be able to understand this term. This entire process is also well known as deferred execution and immediate execution in LINQ.


You can also have a look at the MVC related articles here:
  1. Custom Button With TagBuilder Using MVC Razor Engine
  2. Smart Working With Custom Value Providers in ASP.NET MVC
  3. Invoke Action With Model Binders in MVC
  4. Extension Helpers Method in MVC
  5. Precompiled Razor View Using RazorGenerator MVC and PreCompiledViewEngine in MVC 4
Let's proceed step-by-step to understand the real facts.
real facts
Step 1: I've chosen already a built application of MVC that deals with entities (DB context). When I first run an application it reaches to the code segment as shown in the following depicted image:
run an application
Step 2: Execute it further and see the result variable, it prompts you with “expanding the results view will enumerate the ienumerable”.
Or you need to iterate over it to get the current value from collection.
Step 3: You can make it enumerable after converting to a list type with the help of the .ToList() method. This is also known as immediate execution in LINQ.
Kindly have a look at the more descriptive image shown below:
I hope you enjoyed this demonstration. A sample application is attached as reference.

I hope you enjoyed and that it may help you down the line.Download the related code from the link given below:
Expanding the Results View Will Enumerate the IEnumerable Using DB Context
Cheers .Net Smile


Post a Comment