<!doctype html>
<html lang="en-US" prefix="og: http://ogp.me/ns#">
<head>

<!-- Meta Tags -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />


<!--Shortcut icon-->
	<link rel="shortcut icon" href="http://mrfalafel.wpengine.com/wp-content/uploads/2014/07/favicon.ico" />


<title> The Four Deadly Sins of LINQ Data Access: Part 4–Too Many Rows - Falafel Software Blog </title>

<!-- Jetpack Site Verification Tags -->
<meta name="google-site-verification" content="m2lks8yZxrgS2mg-ayioPjKgyAiIaA3O9sTNE-T2Wqg" />

<!-- This site is optimized with the Yoast SEO plugin v5.8 - https://yoast.com/wordpress/plugins/seo/ -->
<link rel="canonical" href="https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-4-too-many-rows/" />
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="article" />
<meta property="og:title" content="The Four Deadly Sins of LINQ Data Access: Part 4–Too Many Rows - Falafel Software Blog" />
<meta property="og:description" content="This is post 4 of 4 in the series &ldquo;The Four Deadly Sins of LINQ&rdquo; The Four Deadly Sins of LINQ Data Access: Part 1–Overly Chatty Queries The Four Deadly Sins of LINQ Data Access: Part 2–Too Many Columns The Four Deadly Sins of LINQ Data Access: Part 3–Insufficiently Chatty Queries The Four Deadly Sins of LINQ Data Access: Part 4–Too Many Rows Introduction So far in this series, I&#8217;ve written about Overly Chatty Queries, Too Many Columns, and Insufficiently Chatty Queries. There is one more big one that I&#8217;ve left until last, because in my view, it&#8217;s the most obvious of all..." />
<meta property="og:url" content="https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-4-too-many-rows/" />
<meta property="og:site_name" content="Falafel Software Blog" />
<meta property="article:section" content="News" />
<meta property="article:published_time" content="2014-03-30T23:17:06-08:00" />
<meta property="article:modified_time" content="2017-02-16T13:42:53-08:00" />
<meta property="og:updated_time" content="2017-02-16T13:42:53-08:00" />
<script type='application/ld+json'>{"@context":"http:\/\/schema.org","@type":"WebSite","@id":"#website","url":"https:\/\/blog.falafel.com\/","name":"Falafel Software Blog","potentialAction":{"@type":"SearchAction","target":"https:\/\/blog.falafel.com\/?s={search_term_string}","query-input":"required name=search_term_string"}}</script>
<!-- / Yoast SEO plugin. -->

<link rel='dns-prefetch' href='//s0.wp.com' />
<link rel='dns-prefetch' href='//s.w.org' />
<link rel="alternate" type="application/rss+xml" title="Falafel Software Blog &raquo; Feed" href="https://blog.falafel.com/feed/" />
<link rel="alternate" type="application/rss+xml" title="Falafel Software Blog &raquo; Comments Feed" href="https://blog.falafel.com/comments/feed/" />
<link rel="alternate" type="application/rss+xml" title="Falafel Software Blog &raquo; The Four Deadly Sins of LINQ Data Access: Part 4–Too Many Rows Comments Feed" href="https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-4-too-many-rows/feed/" />
		<script type="text/javascript">
			window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/blog.falafel.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.9.2"}};
			!function(a,b,c){function d(a,b){var c=String.fromCharCode;l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,a),0,0);var d=k.toDataURL();l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,b),0,0);var e=k.toDataURL();return d===e}function e(a){var b;if(!l||!l.fillText)return!1;switch(l.textBaseline="top",l.font="600 32px Arial",a){case"flag":return!(b=d([55356,56826,55356,56819],[55356,56826,8203,55356,56819]))&&(b=d([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]),!b);case"emoji":return b=d([55358,56794,8205,9794,65039],[55358,56794,8203,9794,65039]),!b}return!1}function f(a){var c=b.createElement("script");c.src=a,c.defer=c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var g,h,i,j,k=b.createElement("canvas"),l=k.getContext&&k.getContext("2d");for(j=Array("flag","emoji"),c.supports={everything:!0,everythingExceptFlag:!0},i=0;i<j.length;i++)c.supports[j[i]]=e(j[i]),c.supports.everything=c.supports.everything&&c.supports[j[i]],"flag"!==j[i]&&(c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&c.supports[j[i]]);c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&!c.supports.flag,c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.everything||(h=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",h,!1),a.addEventListener("load",h,!1)):(a.attachEvent("onload",h),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),g=c.source||{},g.concatemoji?f(g.concatemoji):g.wpemoji&&g.twemoji&&(f(g.twemoji),f(g.wpemoji)))}(window,document,window._wpemojiSettings);
		</script>
		<style type="text/css">
img.wp-smiley,
img.emoji {
	display: inline !important;
	border: none !important;
	box-shadow: none !important;
	height: 1em !important;
	width: 1em !important;
	margin: 0 .07em !important;
	vertical-align: -0.1em !important;
	background: none !important;
	padding: 0 !important;
}
</style>
<link rel='stylesheet' id='crayon-css'  href='https://blog.falafel.com/wp-content/plugins/crayon-syntax-highlighter/css/min/crayon.min.css?ver=_2.7.2_beta' type='text/css' media='all' />
<link rel='stylesheet' id='crayon-theme-monokai-css'  href='https://blog.falafel.com/wp-content/plugins/crayon-syntax-highlighter/themes/monokai/monokai.css?ver=_2.7.2_beta' type='text/css' media='all' />
<link rel='stylesheet' id='crayon-font-monaco-css'  href='https://blog.falafel.com/wp-content/plugins/crayon-syntax-highlighter/fonts/monaco.css?ver=_2.7.2_beta' type='text/css' media='all' />
<link rel='stylesheet' id='unslider-css-css'  href='https://blog.falafel.com/wp-content/uploads/801/833/public/assets/css/252.css?ver=1.1.2' type='text/css' media='all' />
<link rel='stylesheet' id='ts_fab_css-css'  href='https://blog.falafel.com/wp-content/plugins/fancier-author-box/css/ts-fab.min.css?ver=1.4' type='text/css' media='all' />
<link rel='stylesheet' id='wordpress-popular-posts-css-css'  href='https://blog.falafel.com/wp-content/plugins/wordpress-popular-posts/public/css/wpp.css?ver=4.0.12' type='text/css' media='all' />
<link rel='stylesheet' id='wp-post-series-frontend-css'  href='https://blog.falafel.com/wp-content/plugins/wp-post-series/assets/css/post-series.css?ver=4.9.2' type='text/css' media='all' />
<link rel='stylesheet' id='rgs-css'  href='https://blog.falafel.com/wp-content/themes/salient/css/rgs.css?ver=6.0.1' type='text/css' media='all' />
<link rel='stylesheet' id='font-awesome-css'  href='https://blog.falafel.com/wp-content/themes/salient/css/font-awesome.min.css?ver=4.9.2' type='text/css' media='all' />
<link rel='stylesheet' id='main-styles-css'  href='https://blog.falafel.com/wp-content/themes/salient-child/style.css?ver=7.0.7' type='text/css' media='all' />
<link rel='stylesheet' id='pretty_photo-css'  href='https://blog.falafel.com/wp-content/themes/salient/css/prettyPhoto.css?ver=7.0.1' type='text/css' media='all' />
<!--[if lt IE 9]>
<link rel='stylesheet' id='nectar-ie8-css'  href='https://blog.falafel.com/wp-content/themes/salient/css/ie8.css?ver=4.9.2' type='text/css' media='all' />
<![endif]-->
<link rel='stylesheet' id='responsive-css'  href='https://blog.falafel.com/wp-content/themes/salient/css/responsive.css?ver=7.0.7' type='text/css' media='all' />
<link rel='stylesheet' id='dynamic-css-css'  href='https://blog.falafel.com/wp-content/themes/salient-child/css/dynamic-combined.css?ver=4.9.2' type='text/css' media='all' />
<link rel='stylesheet' id='jetpack-authors-widget-css'  href='https://blog.falafel.com/wp-content/plugins/jetpack/modules/widgets/authors/style.css?ver=20161228' type='text/css' media='all' />
<link rel='stylesheet' id='salient_child_custom_css-css'  href='https://blog.falafel.com/wp-content/themes/salient-child/last.css?ver=4.9.2' type='text/css' media='all' />
<link rel='stylesheet' id='jetpack_css-css'  href='https://blog.falafel.com/wp-content/plugins/jetpack/css/jetpack.css?ver=5.5.1' type='text/css' media='all' />
<script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var gadwpUAEventsData = {"options":{"event_tracking":"1","event_downloads":"zip|ra*|mp*|avi|flv|mpeg|pdf|doc*|ppt*|xls*|jp*|png|gif|tiff|bmp|txt","event_bouncerate":1,"aff_tracking":0,"event_affiliates":"\/out\/","hash_tracking":0,"root_domain":"falafel.com","event_timeout":100,"event_precision":0,"event_formsubmit":0,"ga_pagescrolldepth_tracking":0}};
/* ]]> */
</script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/plugins/google-analytics-dashboard-for-wp/front/js/tracking-analytics-events.js?ver=5.1.2.2'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var CrayonSyntaxSettings = {"version":"_2.7.2_beta","is_admin":"0","ajaxurl":"https:\/\/blog.falafel.com\/wp-admin\/admin-ajax.php","prefix":"crayon-","setting":"crayon-setting","selected":"crayon-setting-selected","changed":"crayon-setting-changed","special":"crayon-setting-special","orig_value":"data-orig-value","debug":""};
var CrayonSyntaxStrings = {"copy":"Press %s to Copy, %s to Paste","minimize":"Click To Expand Code"};
/* ]]> */
</script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/plugins/crayon-syntax-highlighter/js/min/crayon.min.js?ver=_2.7.2_beta'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/uploads/801/833/public/assets/js/279.js?ver=1.1.2'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/uploads/801/833/public/assets/js/182.js?ver=1.1.2'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/uploads/801/833/public/assets/js/684.js?ver=1.1.2'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/plugins/fancier-author-box/js/ts-fab.min.js?ver=1.4'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var wpp_params = {"sampling_active":"","sampling_rate":"100","ajax_url":"https:\/\/blog.falafel.com\/wp-admin\/admin-ajax.php","action":"update_views_ajax","ID":"139","token":"915a36905b"};
/* ]]> */
</script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/plugins/wordpress-popular-posts/public/js/wpp.js?ver=4.0.12'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/themes/salient/js/modernizr.js?ver=2.6.2'></script>
<link rel='https://api.w.org/' href='https://blog.falafel.com/wp-json/' />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://blog.falafel.com/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://blog.falafel.com/wp-includes/wlwmanifest.xml" /> 
<link rel='shortlink' href='https://blog.falafel.com/?p=139' />
<link rel="alternate" type="application/json+oembed" href="https://blog.falafel.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fblog.falafel.com%2Fthe-four-deadly-sins-of-linq-data-access-part-4-too-many-rows%2F" />
<link rel="alternate" type="text/xml+oembed" href="https://blog.falafel.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fblog.falafel.com%2Fthe-four-deadly-sins-of-linq-data-access-part-4-too-many-rows%2F&#038;format=xml" />

<link rel='dns-prefetch' href='//v0.wordpress.com'/>
<style type="text/css">body .section-title #portfolio-nav a:hover i{opacity:0.75;}.pagination-navigation{-webkit-filter:url("https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-4-too-many-rows/#goo");filter:url("https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-4-too-many-rows/#goo");}</style><style type="text/css">
.avatar {vertical-align:middle; margin-right:5px;}
.credit {font-size: 50%;}
</style>
		<link rel="icon" href="https://blog.falafel.com/wp-content/uploads/2015/09/cropped-falafel.com_-32x32.png" sizes="32x32" />
<link rel="icon" href="https://blog.falafel.com/wp-content/uploads/2015/09/cropped-falafel.com_-192x192.png" sizes="192x192" />
<link rel="apple-touch-icon-precomposed" href="https://blog.falafel.com/wp-content/uploads/2015/09/cropped-falafel.com_-180x180.png" />
<meta name="msapplication-TileImage" content="https://blog.falafel.com/wp-content/uploads/2015/09/cropped-falafel.com_-270x270.png" />
<!-- BEGIN GADWP v5.1.2.2 Universal Analytics - https://deconf.com/google-analytics-dashboard-wordpress/ -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-671011-6', 'auto');
  ga('require', 'displayfeatures');
  ga('require', 'linkid');
  ga('send', 'pageview');
</script>
<!-- END GADWP Universal Analytics -->

</head>


<body class="post-template-default single single-post postid-139 single-format-standard nectar-auto-lightbox" data-header-inherit-rc="false" data-header-search="true" data-animated-anchors="false" data-ajax-transitions="false" data-full-width-header="false" data-slide-out-widget-area="false" data-loading-animation="spin" data-bg-header="false" data-ext-responsive="true" data-header-resize="1" data-header-color="light" data-transparent-header="false" data-smooth-scrolling="0" data-responsive="1" >



<div id="header-space"></div>


<div id="header-outer" data-has-menu="true"  data-user-set-bg="#ffffff" data-format="default" data-cart="false" data-transparency-option="0" data-shrink-num="6" data-full-width="false" data-using-secondary="0" data-using-logo="1" data-logo-height="80" data-padding="10" data-header-resize="1">

	
<div id="search-outer" class="nectar">
		
	<div id="search">
	  	 
		<div class="container">
		  	 	
		     <div id="search-box">
		     	
		     	<div class="col span_12">
			      	<form action="https://blog.falafel.com" method="GET">
			      		<input type="text" name="s" id="s" value="Start Typing..." data-placeholder="Start Typing..." />
			      	</form>
			      			        </div><!--/span_12-->
			      
		     </div><!--/search-box-->
		     
		     <div id="close"><a href="#"><span class="icon-salient-x" aria-hidden="true"></span></a></div>
		     
		 </div><!--/container-->
	    
	</div><!--/search-->
	  
</div><!--/search-outer-->
	<header id="top">

		<div class="container">

			<div class="row">

				<div class="col span_3">

<a id="logo" href="http://blog.falafel.com">

						<img class="default-logo dark-version" alt="Falafel Blog" src="https://blog.falafel.com/wp-content/uploads/2016/04/blog-logo.png"><img class="retina-logo  dark-version" alt="Falafel Blog" src="http://blog.falafel.com/wp-content/uploads/2016/04/blog-logo.png"></a>
                        
                        
				</div><!--/span_3-->

				<div class="col_9 col_last">
<div class="textwidget"><a target="_blank" href="/feed"><i class="icon-rss"></i> </a>
<p>RSS</p></div>

					<a href="#mobilemenu" id="toggle-nav"><i class="icon-reorder"></i></a>
					
					<nav>
						<ul class="buttons">
							<li id="search-btn"><div><a href="#searchbox"><span class="icon-salient-search" aria-hidden="true"></span></a></div> </li>

													</ul>
						<ul class="sf-menu">
							<li id="menu-item-1824" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1824"><a href="http://falafel.com">Falafel</a></li>
<li id="menu-item-1826" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1826"><a href="http://falafel.com/consulting">Consulting</a></li>
<li id="menu-item-1825" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1825"><a href="http://falafel.com/training">Training</a></li>
<li id="menu-item-1827" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1827"><a href="http://falafel.com/company">Company</a></li>
<li id="menu-item-1828" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1828"><a href="https://store.falafel.com/">Store</a></li>
						</ul>

					</nav>

				</div><!--/span_9-->
			</div><!--/row-->

			
		</div><!--/container-->
	</header>


	<div class="ns-loading-cover"></div>

</div><!--/header-outer-->


<div id="mobile-menu">

	<div class="container">
		<ul>
			<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1824"><a href="http://falafel.com">Falafel</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1826"><a href="http://falafel.com/consulting">Consulting</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1825"><a href="http://falafel.com/training">Training</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1827"><a href="http://falafel.com/company">Company</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1828"><a href="https://store.falafel.com/">Store</a></li>
<li id="mobile-search">
					<form action="https://blog.falafel.com" method="GET">
			      		<input type="text" name="s" value="" placeholder="Search.." />
					</form>
					</li>		</ul>
	</div>

</div>

<div id="ajax-loading-screen" data-method="ajax"><span class="loading-icon "> <span class="default-skin-loading-icon"></span> </span></div>
<div id="ajax-content-wrap">






<div class="container-wrap  ">

	<div class="container main-content">
		
					
			
					<div class="row heading-title" data-header-style="default">
						<div class="col span_12 section-title blog-title">
														<h1 class="entry-title">The Four Deadly Sins of LINQ Data Access: Part 4–Too Many Rows</h1>
							
							<div id="single-below-header">
								<span class="meta-author vcard author"><span class="fn">By <a href="https://blog.falafel.com/author/guest-posts/" title="Posts by Falafel Posts" rel="author">Falafel Posts</a></span></span><!--
  								--><span class="meta-date date updated">March 30, 2014</span><!--
								--><span class="meta-category"><a href="https://blog.falafel.com/category/news_/">News</a></span> 							</ul><!--project-additional-->
							</div><!--/single-below-header-->
							
															<div id="single-meta" data-sharing="1">
									<ul>
										
										<li class="meta-comment-count">
											<a href="https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-4-too-many-rows/#respond"><i class="icon-default-style steadysets-icon-chat"></i> <span class="dsq-postid" data-dsqidentifier="139 ">No Comments</span></a>
										</li>
										
									 	<li>
									   		<span class="n-shortcode"><a href="#" class="nectar-love" id="nectar-love-139" title="Love this"> <i class="icon-salient-heart"></i><span class="nectar-love-count">0</span></a></span>									   	</li>

										<li class="meta-share-count"><a href="#"><i class="icon-default-style steadysets-icon-share"></i><span class="share-count-total">0</span></a> <div class="nectar-social"><a class='facebook-share nectar-sharing' href='#' title='Share this'> <i class='icon-facebook'></i> <span class='count'></span></a><a class='twitter-share nectar-sharing' href='#' title='Tweet this'> <i class='icon-twitter'></i> <span class='count'></span></a><a class='google-plus-share nectar-sharing-alt' href='#' title='Share this'> <i class='icon-google-plus'></i> <span class='count'> 0 </span></a><a class='linkedin-share nectar-sharing' href='#' title='Share this'> <i class='icon-linkedin'></i> <span class='count'> </span></a><a class='pinterest-share nectar-sharing' href='#' title='Pin this'> <i class='icon-pinterest'></i> <span class='count'></span></a></div></li>
										
			
									</ul>
									
									
								</div><!--/single-meta-->

														</div><!--/section-title-->
					</div><!--/row-->
				
						
					
		<div class="row">
			
			<div id="post-area" class="col span_9">
<article id="post-139" class="regular post-139 post type-post status-publish format-standard hentry category-news_ post_series-four-deadly-linq-sins">

	<div class="inner-wrap animated">

		<div class="post-content">
			
						
			
			<div class="content-inner">
				
								
								
			   
				<aside class="wp-post-series-box series-four-deadly-linq-sins expandable">
	<p class="wp-post-series-name">
		This is post 4 of 4 in the series <em>&ldquo;The Four Deadly Sins of LINQ&rdquo;</em>	</p>

	
		<nav class="wp-post-series-nav">
			<ol>
									<li>
						<a href="https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-1-overly-chatty-queries/">						The Four Deadly Sins of LINQ Data Access: Part 1–Overly Chatty Queries						</a>					</li>
									<li>
						<a href="https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-2-too-many-columns/">						The Four Deadly Sins of LINQ Data Access: Part 2–Too Many Columns						</a>					</li>
									<li>
						<a href="https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-3-insufficiently-chatty-queries/">						The Four Deadly Sins of LINQ Data Access: Part 3–Insufficiently Chatty Queries						</a>					</li>
									<li>
												The Four Deadly Sins of LINQ Data Access: Part 4–Too Many Rows											</li>
							</ol>
		</nav>
	
			
	</aside>
<h1>Introduction</h1>
<p>So far in this series, I&#8217;ve written about <a style="line-height: 1.5" href="http://blog.falafel.com/blogs/AdamAnderson/adam-anderson/2014/02/14/the-four-deadly-sins-of-linq-data-access-part-1-overly-chatty-queries" target="_blank">Overly Chatty Queries</a><span style="line-height: 1.5">, </span><a style="line-height: 1.5" href="http://blog.falafel.com/blogs/AdamAnderson/adam-anderson/2014/02/28/the-four-deadly-sins-of-linq-data-access-part-2-too-many-columns" target="_blank">Too Many Columns</a><span style="line-height: 1.5">, and </span><a style="line-height: 1.5" href="http://blog.falafel.com/blogs/AdamAnderson/adam-anderson/2014/03/14/the-four-deadly-sins-of-linq-data-access-part-3-insufficiently-chatty-queries" target="_blank">Insufficiently Chatty Queries</a><span style="line-height: 1.5">. There is one more big one that I&#8217;ve left until last, because in my view, it&#8217;s the most obvious of all the sins. However, with all of the others out of the way, let&#8217;s take a moment to talk about the Sin&#8230; of Too Many Rows.</span></p>
<h1>Confession</h1>
<p>As a consultant, I probably see more than my fair share of poor-quality code; the projects that are struggling are the ones that need our help. Even considering that, I have seen code like this alarmingly often:</p>
<!-- Crayon Syntax Highlighter v_2.7.2_beta -->

		<div id="crayon-5a6ad0c6883c6923270314" class="crayon-syntax crayon-theme-monokai crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
		
			<div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><span class="crayon-title"></span>
			<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><div class="crayon-button crayon-nums-button" title="Toggle Line Numbers"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-plain-button" title="Toggle Plain Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-expand-button" title="Expand Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-copy-button" title="Copy"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window"><div class="crayon-button-icon"></div></div><span class="crayon-language">C#</span></div></div>
			<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
			<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;">
var customers = Customers.ToList();
 
(from customer in customers
where customer.Country == "USA"
select customer).Dump();</textarea></div>
			<div class="crayon-main" style="">
				<table class="crayon-table">
					<tr class="crayon-row">
				<td class="crayon-nums " data-settings="show">
					<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;"><div class="crayon-num" data-line="crayon-5a6ad0c6883c6923270314-1">1</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883c6923270314-2">2</div><div class="crayon-num" data-line="crayon-5a6ad0c6883c6923270314-3">3</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883c6923270314-4">4</div><div class="crayon-num" data-line="crayon-5a6ad0c6883c6923270314-5">5</div></div>
				</td>
						<td class="crayon-code"><div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><div class="crayon-line" id="crayon-5a6ad0c6883c6923270314-1"><span class="crayon-t">var</span><span class="crayon-h"> </span><span class="crayon-v">customers</span><span class="crayon-h"> </span><span class="crayon-o">=</span><span class="crayon-h"> </span><span class="crayon-v">Customers</span><span class="crayon-sy">.</span><span class="crayon-e">ToList</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883c6923270314-2"> </div><div class="crayon-line" id="crayon-5a6ad0c6883c6923270314-3"><span class="crayon-sy">(</span><span class="crayon-e">from </span><span class="crayon-e">customer </span><span class="crayon-st">in</span><span class="crayon-h"> </span><span class="crayon-e">customers</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883c6923270314-4"><span class="crayon-e">where </span><span class="crayon-v">customer</span><span class="crayon-sy">.</span><span class="crayon-v">Country</span><span class="crayon-h"> </span><span class="crayon-o">==</span><span class="crayon-h"> </span><span class="crayon-s">"USA"</span></div><div class="crayon-line" id="crayon-5a6ad0c6883c6923270314-5"><span class="crayon-e">select </span><span class="crayon-v">customer</span><span class="crayon-sy">)</span><span class="crayon-sy">.</span><span class="crayon-e">Dump</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div></div></td>
					</tr>
				</table>
			</div>
		</div>
<!-- [Format Time: 0.0008 seconds] -->

<p>Do you see the problem here? Let&#8217;s have a look at the generated SQL:</p>
<!-- Crayon Syntax Highlighter v_2.7.2_beta -->

		<div id="crayon-5a6ad0c6883cf637035109" class="crayon-syntax crayon-theme-monokai crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
		
			<div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><span class="crayon-title"></span>
			<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><div class="crayon-button crayon-nums-button" title="Toggle Line Numbers"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-plain-button" title="Toggle Plain Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-expand-button" title="Expand Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-copy-button" title="Copy"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window"><div class="crayon-button-icon"></div></div><span class="crayon-language">Transact-SQL</span></div></div>
			<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
			<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;">
SELECT
[Extent1].[CustomerID] AS [CustomerID],
[Extent1].[CompanyName] AS [CompanyName],
[Extent1].[ContactName] AS [ContactName],
[Extent1].[ContactTitle] AS [ContactTitle],
[Extent1].[Address] AS [Address],
[Extent1].[City] AS [City],
[Extent1].[Region] AS [Region],
[Extent1].[PostalCode] AS [PostalCode],
[Extent1].[Country] AS [Country],
[Extent1].[Phone] AS [Phone],
[Extent1].[Fax] AS [Fax]
FROM [dbo].[Customers] AS [Extent1]</textarea></div>
			<div class="crayon-main" style="">
				<table class="crayon-table">
					<tr class="crayon-row">
				<td class="crayon-nums " data-settings="show">
					<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;"><div class="crayon-num" data-line="crayon-5a6ad0c6883cf637035109-1">1</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883cf637035109-2">2</div><div class="crayon-num" data-line="crayon-5a6ad0c6883cf637035109-3">3</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883cf637035109-4">4</div><div class="crayon-num" data-line="crayon-5a6ad0c6883cf637035109-5">5</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883cf637035109-6">6</div><div class="crayon-num" data-line="crayon-5a6ad0c6883cf637035109-7">7</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883cf637035109-8">8</div><div class="crayon-num" data-line="crayon-5a6ad0c6883cf637035109-9">9</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883cf637035109-10">10</div><div class="crayon-num" data-line="crayon-5a6ad0c6883cf637035109-11">11</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883cf637035109-12">12</div><div class="crayon-num" data-line="crayon-5a6ad0c6883cf637035109-13">13</div></div>
				</td>
						<td class="crayon-code"><div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><div class="crayon-line" id="crayon-5a6ad0c6883cf637035109-1"><span class="crayon-k">SELECT</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883cf637035109-2"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">CustomerID</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">CustomerID</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883cf637035109-3"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">CompanyName</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">CompanyName</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883cf637035109-4"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">ContactName</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">ContactName</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883cf637035109-5"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">ContactTitle</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">ContactTitle</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883cf637035109-6"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Address</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Address</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883cf637035109-7"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">City</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">City</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883cf637035109-8"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Region</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Region</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883cf637035109-9"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">PostalCode</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">PostalCode</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883cf637035109-10"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Country</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Country</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883cf637035109-11"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Phone</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Phone</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883cf637035109-12"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Fax</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Fax</span><span class="crayon-sy">]</span></div><div class="crayon-line" id="crayon-5a6ad0c6883cf637035109-13"><span class="crayon-k">FROM</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">dbo</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Customers</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span></div></div></td>
					</tr>
				</table>
			</div>
		</div>
<!-- [Format Time: 0.0038 seconds] -->

<p>Something missing? There is no WHERE clause! That means that the entire Customers table just got returned from the DB into memory and the filtering was done there. For a small table like Northwind Customers, this is not really a problem, but for large tables in production databases, it is a huge problem. Like all other sins, it can consume inordinate resources on the database server, on the network, and on the middle tier server.</p>
<h1>Repentance</h1>
<p>The way to avoid committing this sin is quite simple: don&#8217;t materialize the query until the absolute last moment before you actually need it and/or before the DB context is disposed. In the above example, it is as simple as either completely eliminating the call to ToList(), or at least moving it to the final statement:</p>
<!-- Crayon Syntax Highlighter v_2.7.2_beta -->

		<div id="crayon-5a6ad0c6883d5124078469" class="crayon-syntax crayon-theme-monokai crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
		
			<div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><span class="crayon-title"></span>
			<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><div class="crayon-button crayon-nums-button" title="Toggle Line Numbers"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-plain-button" title="Toggle Plain Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-expand-button" title="Expand Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-copy-button" title="Copy"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window"><div class="crayon-button-icon"></div></div><span class="crayon-language">C#</span></div></div>
			<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
			<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;">
var customers = Customers;
 
(from customer in customers
where customer.Country == "USA"
select customer).Dump();</textarea></div>
			<div class="crayon-main" style="">
				<table class="crayon-table">
					<tr class="crayon-row">
				<td class="crayon-nums " data-settings="show">
					<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;"><div class="crayon-num" data-line="crayon-5a6ad0c6883d5124078469-1">1</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883d5124078469-2">2</div><div class="crayon-num" data-line="crayon-5a6ad0c6883d5124078469-3">3</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883d5124078469-4">4</div><div class="crayon-num" data-line="crayon-5a6ad0c6883d5124078469-5">5</div></div>
				</td>
						<td class="crayon-code"><div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><div class="crayon-line" id="crayon-5a6ad0c6883d5124078469-1"><span class="crayon-t">var</span><span class="crayon-h"> </span><span class="crayon-v">customers</span><span class="crayon-h"> </span><span class="crayon-o">=</span><span class="crayon-h"> </span><span class="crayon-v">Customers</span><span class="crayon-sy">;</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883d5124078469-2"> </div><div class="crayon-line" id="crayon-5a6ad0c6883d5124078469-3"><span class="crayon-sy">(</span><span class="crayon-e">from </span><span class="crayon-e">customer </span><span class="crayon-st">in</span><span class="crayon-h"> </span><span class="crayon-e">customers</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883d5124078469-4"><span class="crayon-e">where </span><span class="crayon-v">customer</span><span class="crayon-sy">.</span><span class="crayon-v">Country</span><span class="crayon-h"> </span><span class="crayon-o">==</span><span class="crayon-h"> </span><span class="crayon-s">"USA"</span></div><div class="crayon-line" id="crayon-5a6ad0c6883d5124078469-5"><span class="crayon-e">select </span><span class="crayon-v">customer</span><span class="crayon-sy">)</span><span class="crayon-sy">.</span><span class="crayon-e">Dump</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">;</span></div></div></td>
					</tr>
				</table>
			</div>
		</div>
<!-- [Format Time: 0.0005 seconds] -->

<p>Generated SQL:</p>
<!-- Crayon Syntax Highlighter v_2.7.2_beta -->

		<div id="crayon-5a6ad0c6883d8897941831" class="crayon-syntax crayon-theme-monokai crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
		
			<div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><span class="crayon-title"></span>
			<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><div class="crayon-button crayon-nums-button" title="Toggle Line Numbers"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-plain-button" title="Toggle Plain Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-expand-button" title="Expand Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-copy-button" title="Copy"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window"><div class="crayon-button-icon"></div></div><span class="crayon-language">Transact-SQL</span></div></div>
			<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
			<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;">
SELECT
[Extent1].[CustomerID] AS [CustomerID],
[Extent1].[CompanyName] AS [CompanyName],
[Extent1].[ContactName] AS [ContactName],
[Extent1].[ContactTitle] AS [ContactTitle],
[Extent1].[Address] AS [Address],
[Extent1].[City] AS [City],
[Extent1].[Region] AS [Region],
[Extent1].[PostalCode] AS [PostalCode],
[Extent1].[Country] AS [Country],
[Extent1].[Phone] AS [Phone],
[Extent1].[Fax] AS [Fax]
FROM [dbo].[Customers] AS [Extent1]
WHERE N'USA' = [Extent1].[Country]</textarea></div>
			<div class="crayon-main" style="">
				<table class="crayon-table">
					<tr class="crayon-row">
				<td class="crayon-nums " data-settings="show">
					<div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;"><div class="crayon-num" data-line="crayon-5a6ad0c6883d8897941831-1">1</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883d8897941831-2">2</div><div class="crayon-num" data-line="crayon-5a6ad0c6883d8897941831-3">3</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883d8897941831-4">4</div><div class="crayon-num" data-line="crayon-5a6ad0c6883d8897941831-5">5</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883d8897941831-6">6</div><div class="crayon-num" data-line="crayon-5a6ad0c6883d8897941831-7">7</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883d8897941831-8">8</div><div class="crayon-num" data-line="crayon-5a6ad0c6883d8897941831-9">9</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883d8897941831-10">10</div><div class="crayon-num" data-line="crayon-5a6ad0c6883d8897941831-11">11</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883d8897941831-12">12</div><div class="crayon-num" data-line="crayon-5a6ad0c6883d8897941831-13">13</div><div class="crayon-num crayon-striped-num" data-line="crayon-5a6ad0c6883d8897941831-14">14</div></div>
				</td>
						<td class="crayon-code"><div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;"><div class="crayon-line" id="crayon-5a6ad0c6883d8897941831-1"><span class="crayon-k">SELECT</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883d8897941831-2"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">CustomerID</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">CustomerID</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883d8897941831-3"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">CompanyName</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">CompanyName</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883d8897941831-4"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">ContactName</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">ContactName</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883d8897941831-5"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">ContactTitle</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">ContactTitle</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883d8897941831-6"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Address</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Address</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883d8897941831-7"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">City</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">City</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883d8897941831-8"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Region</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Region</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883d8897941831-9"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">PostalCode</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">PostalCode</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883d8897941831-10"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Country</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Country</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line" id="crayon-5a6ad0c6883d8897941831-11"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Phone</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Phone</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883d8897941831-12"><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Fax</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Fax</span><span class="crayon-sy">]</span></div><div class="crayon-line" id="crayon-5a6ad0c6883d8897941831-13"><span class="crayon-k">FROM</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">dbo</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Customers</span><span class="crayon-sy">]</span><span class="crayon-h"> </span><span class="crayon-k">AS</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span></div><div class="crayon-line crayon-striped-line" id="crayon-5a6ad0c6883d8897941831-14"><span class="crayon-k">WHERE</span><span class="crayon-h"> </span><span class="crayon-i">N</span><span class="crayon-s">'USA'</span><span class="crayon-h"> </span><span class="crayon-o">=</span><span class="crayon-h"> </span><span class="crayon-sy">[</span><span class="crayon-i">Extent1</span><span class="crayon-sy">]</span><span class="crayon-sy">.</span><span class="crayon-sy">[</span><span class="crayon-i">Country</span><span class="crayon-sy">]</span></div></div></td>
					</tr>
				</table>
			</div>
		</div>
<!-- [Format Time: 0.0038 seconds] -->

<p>Now the WHERE clause is being sent to the database and only matching rows are returned and materialized as objects in the middle tier. That&#8217;s really all there is to it when it comes to the code, but perhaps it&#8217;s worth taking a moment to explain what the difference is.</p>
<h1>Indulgence</h1>
<p>A quick aside: I already made one complaint about LINQ to Entities, which is that it really doesn&#8217;t generate very good SQL. Here&#8217;s another one pertinent to this sin: I think LINQ to Entities does <em style="line-height: 1.5">too good </em><span style="line-height: 1.5">of a job at hiding what it&#8217;s doing (until it doesn&#8217;t and you must become intimately familiar with the internals), making it too easy for naive developers to write wasteful queries without even realizing what&#8217;s going on. It all boils down to two important interfaces: IEnumerable and IQueryable.</span></p>
<p>When you write a data access query using LINQ (whether by keywords or by methods with lambda expressions), what is really happening is that you are calling the LINQ extension methods of the IQueryable interface. As long as the code doesn&#8217;t try to access the contents of the IQueryable either explicitly (e.g. calling a method like ToList()) or implicitly (e.g. by attempting to iterate through the results in a foreach loop), all of these method calls simply build up a query expression but don&#8217;t execute it. Only once the code actually tries to access the data does the query execute, and at this point the results of the query are mapped into a collection in-memory objects. This collection (typically a generic List) implements the IEnumerable interface, which has exactly the same LINQ extension methods as IQueryable. The difference is that these LINQ methods execute immediately on objects already in memory. Be aware that there is a difference and make every effort to defer execution of the queries until all row and column restrictions (via WHERE and SELECT operations) have been defined.</p>
<h1>Summary</h1>
<p>The Deadly Sins of LINQ Data Access all have a unifying underlying principle: Select only as much data as you actually need, in as few calls as possible. Don&#8217;t query one row at a time; don&#8217;t return a whole object when you only needed a handful of fields; don&#8217;t try to do too much with a single query, and in the name all that is good, don&#8217;t select too many rows and then filter them afterwards! Now, go forth and sin no more! (*At least in regards to querying databases with LINQ)</p>
<div id="ts-fab-below" class="ts-fab-wrapper"><span class="screen-reader-text">The following two tabs change content below.</span><ul class="ts-fab-list"><li class="ts-fab-bio-link"><a href="#ts-fab-bio-below">Bio</a></li><li class="ts-fab-latest-posts-link"><a href="#ts-fab-latest-posts-below">Latest Posts</a></li></ul><div class="ts-fab-tabs">
	<div class="ts-fab-tab" id="ts-fab-bio-below">
		<div class="ts-fab-avatar"><img alt='' src='https://secure.gravatar.com/avatar/fc34bc995686934bb21b8fabccf4764a?s=80&#038;d=mm&#038;r=g' srcset='https://secure.gravatar.com/avatar/fc34bc995686934bb21b8fabccf4764a?s=160&#038;d=mm&#038;r=g 2x' class='avatar avatar-80 photo' height='80' width='80' /><div class="ts-fab-social-links"></div>
		</div>
		
		<div class="ts-fab-text">
			<div class="ts-fab-header"><h4><a href="http://falafel.com" rel="nofollow">Falafel Posts</a></h4></div><!-- /.ts-fab-header -->
			<div class="ts-fab-content"></div>
		</div>
	</div>
	<div class="ts-fab-tab" id="ts-fab-latest-posts-below">
		<div class="ts-fab-avatar"><img alt='' src='https://secure.gravatar.com/avatar/fc34bc995686934bb21b8fabccf4764a?s=80&#038;d=mm&#038;r=g' srcset='https://secure.gravatar.com/avatar/fc34bc995686934bb21b8fabccf4764a?s=160&#038;d=mm&#038;r=g 2x' class='avatar avatar-80 photo' height='80' width='80' /><div class="ts-fab-social-links"></div>
		</div>
		<div class="ts-fab-text">
			<div class="ts-fab-header">
				<h4>Latest posts by Falafel Posts <span class="latest-see-all">(<a href="https://blog.falafel.com/author/guest-posts/" rel="nofollow">see all</a>)</span></h4>
			</div>
			<ul class="ts-fab-latest">
				<li>
					<a href="https://blog.falafel.com/matching-query-string-rewrite-rule-iis/">Matching Complex Query String Rewrite Rule in IIS</a><span> - March 22, 2017</span> 
				</li>
				<li>
					<a href="https://blog.falafel.com/using-google-services-uwp-c-apps-part-2/">Using Google Services in UWP C# Apps – Part 2</a><span> - February 7, 2017</span> 
				</li>
				<li>
					<a href="https://blog.falafel.com/using-google-services-in-uwp-c-apps-part-1/">Using Google Services in UWP C# Apps – Part 1</a><span> - February 6, 2017</span> 
				</li>
				<li>
					<a href="https://blog.falafel.com/redis-caching-in-the-google-cloud-platform/">Redis Caching in the Google Cloud Platform</a><span> - February 3, 2017</span> 
				</li>
				<li>
					<a href="https://blog.falafel.com/entity-framework-with-google-cloud-sql/">Entity Framework with Google Cloud SQL</a><span> - February 2, 2017</span> 
				</li>
		</ul></div>
	</div>
		</div>
	</div>				
									
			</div><!--/content-inner-->
			
		</div><!--/post-content-->

	</div><!--/inner-wrap-->
		
</article><!--/article-->
					<div class="comments-section">
						   
<div id="disqus_thread">
    </div>

<script type="text/javascript">
var disqus_url = 'https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-4-too-many-rows/';
var disqus_identifier = '139 ';
var disqus_container_id = 'disqus_thread';
var disqus_shortname = 'falafelblogs';
var disqus_title = "The Four Deadly Sins of LINQ Data Access: Part 4–Too Many Rows";
var disqus_config_custom = window.disqus_config;
var disqus_config = function () {
    /*
    All currently supported events:
    onReady: fires when everything is ready,
    onNewComment: fires when a new comment is posted,
    onIdentify: fires when user is authenticated
    */
    
    
    this.language = '';
        this.callbacks.onReady.push(function () {

        // sync comments in the background so we don't block the page
        var script = document.createElement('script');
        script.async = true;
        script.src = '?cf_action=sync_comments&post_id=139';

        var firstScript = document.getElementsByTagName('script')[0];
        firstScript.parentNode.insertBefore(script, firstScript);
    });
    
    if (disqus_config_custom) {
        disqus_config_custom.call(this);
    }
};

(function() {
    var dsq = document.createElement('script'); dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>

					 </div>   


				
				

			</div><!--/span_9-->
			
							
				<div id="sidebar" class="col span_3 col_last">
					<div id="blog_subscription-2" class="widget jetpack_subscription_widget"><h4>Subscribe to the Falafel Blog</h4>
			<form action="#" method="post" accept-charset="utf-8" id="subscribe-blog-blog_subscription-2">
				<div id="subscribe-text"><p>Subscribe and receive email notifications when we put out more awesome Falafel news!</p>
</div>					<p id="subscribe-email">
						<label id="jetpack-subscribe-label" for="subscribe-field-blog_subscription-2">
							Get more Falafels now...						</label>
						<input type="email" name="email" required="required" class="required" value="" id="subscribe-field-blog_subscription-2" placeholder="Get more Falafels now..." />
					</p>

					<p id="subscribe-submit">
						<input type="hidden" name="action" value="subscribe" />
						<input type="hidden" name="source" value="https://blog.falafel.com/the-four-deadly-sins-of-linq-data-access-part-4-too-many-rows/" />
						<input type="hidden" name="sub-type" value="widget" />
						<input type="hidden" name="redirect_fragment" value="blog_subscription-2" />
												<input type="submit" value="Subscribe" name="jetpack_subscriptions_widget" />
					</p>
							</form>

			<script>
			/*
			Custom functionality for safari and IE
			 */
			(function( d ) {
				// In case the placeholder functionality is available we remove labels
				if ( ( 'placeholder' in d.createElement( 'input' ) ) ) {
					var label = d.querySelector( 'label[for=subscribe-field-blog_subscription-2]' );
						label.style.clip 	 = 'rect(1px, 1px, 1px, 1px)';
						label.style.position = 'absolute';
						label.style.height   = '1px';
						label.style.width    = '1px';
						label.style.overflow = 'hidden';
				}

				// Make sure the email value is filled in before allowing submit
				var form = d.getElementById('subscribe-blog-blog_subscription-2'),
					input = d.getElementById('subscribe-field-blog_subscription-2'),
					handler = function( event ) {
						if ( '' === input.value ) {
							input.focus();

							if ( event.preventDefault ){
								event.preventDefault();
							}

							return false;
						}
					};

				if ( window.addEventListener ) {
					form.addEventListener( 'submit', handler, false );
				} else {
					form.attachEvent( 'onsubmit', handler );
				}
			})( document );
			</script>
				
</div><div id="advads_ad_widget-2" class="widget falaf-widget"><div id="falaf-slider-755" class="falaf-slider-16076263 falaf-slider"><ul><li><a href="http://falafel.com/company/contact"><img width="300" height="500" src='https://blog.falafel.com/wp-content/uploads/2016/04/architecture-portrait.png' alt='' title='architecture-portrait' /></a></li><li><a href="http://falafel.com/company/contact"><img width="300" height="500" src='https://blog.falafel.com/wp-content/uploads/2016/04/azure-portrait.png' alt='' title='azure-portrait' /></a></li><li><a href="http://store.falafel.com/products/mentoring-express"><img width="300" height="500" src='https://blog.falafel.com/wp-content/uploads/2016/04/kendo-portrait.png' alt='' title='kendo-portrait' /></a></li><li><a href="http://store.falafel.com/collections/sitefinity-add-ons"><img width="300" height="500" src='https://blog.falafel.com/wp-content/uploads/2016/04/Sitefinity-Vertical.png' alt='' title='Sitefinity Vertical' /></a></li></ul></div><script>jQuery(function() { jQuery( ".falaf-slider-16076263" ).unslider({ delay:8000, autoplay:true, nav:false, arrows:false }); });</script></div><div id="tag_cloud-2" class="widget widget_tag_cloud"><h4>Tags</h4><div class="tagcloud"><a href="https://blog.falafel.com/tag/net/" class="tag-cloud-link tag-link-52 tag-link-position-1" style="font-size: 16.4pt;" aria-label=".net (71 items)">.net</a>
<a href="https://blog.falafel.com/tag/android_/" class="tag-cloud-link tag-link-88 tag-link-position-2" style="font-size: 17.4181818182pt;" aria-label="android (87 items)">android</a>
<a href="https://blog.falafel.com/tag/angularjs/" class="tag-cloud-link tag-link-81 tag-link-position-3" style="font-size: 9.78181818182pt;" aria-label="angularjs (21 items)">angularjs</a>
<a href="https://blog.falafel.com/tag/aspnet_/" class="tag-cloud-link tag-link-34 tag-link-position-4" style="font-size: 14.3636363636pt;" aria-label="asp.net (49 items)">asp.net</a>
<a href="https://blog.falafel.com/tag/asp-net-mvc/" class="tag-cloud-link tag-link-393 tag-link-position-5" style="font-size: 10.5454545455pt;" aria-label="ASP.NET MVC (24 items)">ASP.NET MVC</a>
<a href="https://blog.falafel.com/tag/azure/" class="tag-cloud-link tag-link-270 tag-link-position-6" style="font-size: 14.1090909091pt;" aria-label="Azure (47 items)">Azure</a>
<a href="https://blog.falafel.com/tag/c/" class="tag-cloud-link tag-link-4 tag-link-position-7" style="font-size: 22pt;" aria-label="C# (200 items)">C#</a>
<a href="https://blog.falafel.com/tag/cms/" class="tag-cloud-link tag-link-26 tag-link-position-8" style="font-size: 10.9272727273pt;" aria-label="CMS (26 items)">CMS</a>
<a href="https://blog.falafel.com/tag/code/" class="tag-cloud-link tag-link-77 tag-link-position-9" style="font-size: 15.7636363636pt;" aria-label="Code (64 items)">Code</a>
<a href="https://blog.falafel.com/tag/css/" class="tag-cloud-link tag-link-19 tag-link-position-10" style="font-size: 12.8363636364pt;" aria-label="CSS (37 items)">CSS</a>
<a href="https://blog.falafel.com/tag/entity-framework/" class="tag-cloud-link tag-link-155 tag-link-position-11" style="font-size: 9.78181818182pt;" aria-label="Entity Framework (21 items)">Entity Framework</a>
<a href="https://blog.falafel.com/tag/eventboard/" class="tag-cloud-link tag-link-261 tag-link-position-12" style="font-size: 9.27272727273pt;" aria-label="EventBoard (19 items)">EventBoard</a>
<a href="https://blog.falafel.com/tag/falafel-software/" class="tag-cloud-link tag-link-446 tag-link-position-13" style="font-size: 9.78181818182pt;" aria-label="Falafel Software (21 items)">Falafel Software</a>
<a href="https://blog.falafel.com/tag/fun_/" class="tag-cloud-link tag-link-31 tag-link-position-14" style="font-size: 12.0727272727pt;" aria-label="Fun (32 items)">Fun</a>
<a href="https://blog.falafel.com/tag/google-cloud-platform/" class="tag-cloud-link tag-link-825 tag-link-position-15" style="font-size: 8pt;" aria-label="Google Cloud Platform (15 items)">Google Cloud Platform</a>
<a href="https://blog.falafel.com/tag/html5/" class="tag-cloud-link tag-link-21 tag-link-position-16" style="font-size: 15.7636363636pt;" aria-label="HTML5 (64 items)">HTML5</a>
<a href="https://blog.falafel.com/tag/ios_/" class="tag-cloud-link tag-link-143 tag-link-position-17" style="font-size: 13.7272727273pt;" aria-label="iOS (44 items)">iOS</a>
<a href="https://blog.falafel.com/tag/iot/" class="tag-cloud-link tag-link-514 tag-link-position-18" style="font-size: 12.7090909091pt;" aria-label="IoT (36 items)">IoT</a>
<a href="https://blog.falafel.com/tag/iphone/" class="tag-cloud-link tag-link-269 tag-link-position-19" style="font-size: 8.38181818182pt;" aria-label="iPhone (16 items)">iPhone</a>
<a href="https://blog.falafel.com/tag/javascript_/" class="tag-cloud-link tag-link-47 tag-link-position-20" style="font-size: 20.8545454545pt;" aria-label="JavaScript (160 items)">JavaScript</a>
<a href="https://blog.falafel.com/tag/jquery/" class="tag-cloud-link tag-link-190 tag-link-position-21" style="font-size: 9.78181818182pt;" aria-label="jQuery (21 items)">jQuery</a>
<a href="https://blog.falafel.com/tag/kendo-ui_/" class="tag-cloud-link tag-link-43 tag-link-position-22" style="font-size: 18.6909090909pt;" aria-label="Kendo UI (108 items)">Kendo UI</a>
<a href="https://blog.falafel.com/tag/linq/" class="tag-cloud-link tag-link-90 tag-link-position-23" style="font-size: 9.01818181818pt;" aria-label="LINQ (18 items)">LINQ</a>
<a href="https://blog.falafel.com/tag/microsoft/" class="tag-cloud-link tag-link-55 tag-link-position-24" style="font-size: 15.7636363636pt;" aria-label="Microsoft (63 items)">Microsoft</a>
<a href="https://blog.falafel.com/tag/mobile_/" class="tag-cloud-link tag-link-59 tag-link-position-25" style="font-size: 18.5636363636pt;" aria-label="Mobile (106 items)">Mobile</a>
<a href="https://blog.falafel.com/tag/mvc/" class="tag-cloud-link tag-link-63 tag-link-position-26" style="font-size: 14.7454545455pt;" aria-label="MVC (53 items)">MVC</a>
<a href="https://blog.falafel.com/tag/mvvm_/" class="tag-cloud-link tag-link-41 tag-link-position-27" style="font-size: 10.9272727273pt;" aria-label="MVVM (26 items)">MVVM</a>
<a href="https://blog.falafel.com/tag/news/" class="tag-cloud-link tag-link-53 tag-link-position-28" style="font-size: 14.2363636364pt;" aria-label="News (48 items)">News</a>
<a href="https://blog.falafel.com/tag/silverlight/" class="tag-cloud-link tag-link-283 tag-link-position-29" style="font-size: 16.6545454545pt;" aria-label="Silverlight (74 items)">Silverlight</a>
<a href="https://blog.falafel.com/tag/sitefinity/" class="tag-cloud-link tag-link-13 tag-link-position-30" style="font-size: 19.5818181818pt;" aria-label="Sitefinity (128 items)">Sitefinity</a>
<a href="https://blog.falafel.com/tag/smartbear/" class="tag-cloud-link tag-link-133 tag-link-position-31" style="font-size: 15.3818181818pt;" aria-label="SmartBear (59 items)">SmartBear</a>
<a href="https://blog.falafel.com/tag/telerik_/" class="tag-cloud-link tag-link-57 tag-link-position-32" style="font-size: 17.4181818182pt;" aria-label="Telerik (86 items)">Telerik</a>
<a href="https://blog.falafel.com/tag/testcomplete/" class="tag-cloud-link tag-link-73 tag-link-position-33" style="font-size: 16.2727272727pt;" aria-label="TestComplete (70 items)">TestComplete</a>
<a href="https://blog.falafel.com/tag/testing/" class="tag-cloud-link tag-link-640 tag-link-position-34" style="font-size: 16.1454545455pt;" aria-label="Testing (68 items)">Testing</a>
<a href="https://blog.falafel.com/tag/visual-studio/" class="tag-cloud-link tag-link-32 tag-link-position-35" style="font-size: 17.4181818182pt;" aria-label="Visual Studio (86 items)">Visual Studio</a>
<a href="https://blog.falafel.com/tag/visual-studio-2015/" class="tag-cloud-link tag-link-626 tag-link-position-36" style="font-size: 12.7090909091pt;" aria-label="Visual Studio 2015 (36 items)">Visual Studio 2015</a>
<a href="https://blog.falafel.com/tag/windows_/" class="tag-cloud-link tag-link-139 tag-link-position-37" style="font-size: 9.78181818182pt;" aria-label="Windows (21 items)">Windows</a>
<a href="https://blog.falafel.com/tag/windows-8/" class="tag-cloud-link tag-link-121 tag-link-position-38" style="font-size: 12.2pt;" aria-label="Windows 8 (33 items)">Windows 8</a>
<a href="https://blog.falafel.com/tag/windows-10/" class="tag-cloud-link tag-link-625 tag-link-position-39" style="font-size: 9.27272727273pt;" aria-label="Windows 10 (19 items)">Windows 10</a>
<a href="https://blog.falafel.com/tag/windows-iot-core/" class="tag-cloud-link tag-link-594 tag-link-position-40" style="font-size: 8.38181818182pt;" aria-label="Windows IoT Core (16 items)">Windows IoT Core</a>
<a href="https://blog.falafel.com/tag/windows-phone/" class="tag-cloud-link tag-link-22 tag-link-position-41" style="font-size: 15.3818181818pt;" aria-label="Windows Phone (59 items)">Windows Phone</a>
<a href="https://blog.falafel.com/tag/xamarin_/" class="tag-cloud-link tag-link-7 tag-link-position-42" style="font-size: 20.3454545455pt;" aria-label="xamarin (146 items)">xamarin</a>
<a href="https://blog.falafel.com/tag/xamarin-android/" class="tag-cloud-link tag-link-84 tag-link-position-43" style="font-size: 14.2363636364pt;" aria-label="Xamarin Android (48 items)">Xamarin Android</a>
<a href="https://blog.falafel.com/tag/xamarin-forms/" class="tag-cloud-link tag-link-8 tag-link-position-44" style="font-size: 16.2727272727pt;" aria-label="Xamarin Forms (70 items)">Xamarin Forms</a>
<a href="https://blog.falafel.com/tag/xaml/" class="tag-cloud-link tag-link-15 tag-link-position-45" style="font-size: 13.4727272727pt;" aria-label="XAML (42 items)">XAML</a></div>
</div>		<div id="authors-4" class="widget widget_authors">			<h4>Authors</h4>			<ul><li><a href="https://blog.falafel.com/author/guest-posts/" title="Posts by Falafel Posts">Falafel Posts</a> (1545)</li>
<li><a href="https://blog.falafel.com/author/lino-tadros/" title="Posts by Lino Tadros">Lino Tadros</a> (158)</li>
</ul>					</div>	<div id="archives-2" class="widget widget_archive"><h4>Archives</h4>		<ul>
			<li><a href='https://blog.falafel.com/2017/03/'>March 2017</a>&nbsp;(1)</li>
	<li><a href='https://blog.falafel.com/2017/02/'>February 2017</a>&nbsp;(5)</li>
	<li><a href='https://blog.falafel.com/2017/01/'>January 2017</a>&nbsp;(14)</li>
	<li><a href='https://blog.falafel.com/2016/12/'>December 2016</a>&nbsp;(10)</li>
	<li><a href='https://blog.falafel.com/2016/11/'>November 2016</a>&nbsp;(12)</li>
	<li><a href='https://blog.falafel.com/2016/10/'>October 2016</a>&nbsp;(15)</li>
	<li><a href='https://blog.falafel.com/2016/09/'>September 2016</a>&nbsp;(17)</li>
	<li><a href='https://blog.falafel.com/2016/08/'>August 2016</a>&nbsp;(13)</li>
	<li><a href='https://blog.falafel.com/2016/07/'>July 2016</a>&nbsp;(13)</li>
	<li><a href='https://blog.falafel.com/2016/06/'>June 2016</a>&nbsp;(25)</li>
	<li><a href='https://blog.falafel.com/2016/05/'>May 2016</a>&nbsp;(22)</li>
	<li><a href='https://blog.falafel.com/2016/04/'>April 2016</a>&nbsp;(8)</li>
	<li><a href='https://blog.falafel.com/2016/03/'>March 2016</a>&nbsp;(12)</li>
	<li><a href='https://blog.falafel.com/2016/02/'>February 2016</a>&nbsp;(34)</li>
	<li><a href='https://blog.falafel.com/2016/01/'>January 2016</a>&nbsp;(38)</li>
	<li><a href='https://blog.falafel.com/2015/12/'>December 2015</a>&nbsp;(9)</li>
	<li><a href='https://blog.falafel.com/2015/11/'>November 2015</a>&nbsp;(9)</li>
	<li><a href='https://blog.falafel.com/2015/10/'>October 2015</a>&nbsp;(40)</li>
	<li><a href='https://blog.falafel.com/2015/09/'>September 2015</a>&nbsp;(15)</li>
	<li><a href='https://blog.falafel.com/2015/08/'>August 2015</a>&nbsp;(43)</li>
	<li><a href='https://blog.falafel.com/2015/07/'>July 2015</a>&nbsp;(15)</li>
	<li><a href='https://blog.falafel.com/2015/06/'>June 2015</a>&nbsp;(22)</li>
	<li><a href='https://blog.falafel.com/2015/05/'>May 2015</a>&nbsp;(16)</li>
	<li><a href='https://blog.falafel.com/2015/04/'>April 2015</a>&nbsp;(24)</li>
	<li><a href='https://blog.falafel.com/2015/03/'>March 2015</a>&nbsp;(14)</li>
	<li><a href='https://blog.falafel.com/2015/02/'>February 2015</a>&nbsp;(11)</li>
	<li><a href='https://blog.falafel.com/2015/01/'>January 2015</a>&nbsp;(22)</li>
	<li><a href='https://blog.falafel.com/2014/12/'>December 2014</a>&nbsp;(26)</li>
	<li><a href='https://blog.falafel.com/2014/11/'>November 2014</a>&nbsp;(29)</li>
	<li><a href='https://blog.falafel.com/2014/10/'>October 2014</a>&nbsp;(43)</li>
	<li><a href='https://blog.falafel.com/2014/09/'>September 2014</a>&nbsp;(50)</li>
	<li><a href='https://blog.falafel.com/2014/08/'>August 2014</a>&nbsp;(27)</li>
	<li><a href='https://blog.falafel.com/2014/07/'>July 2014</a>&nbsp;(43)</li>
	<li><a href='https://blog.falafel.com/2014/06/'>June 2014</a>&nbsp;(47)</li>
	<li><a href='https://blog.falafel.com/2014/05/'>May 2014</a>&nbsp;(29)</li>
	<li><a href='https://blog.falafel.com/2014/04/'>April 2014</a>&nbsp;(25)</li>
	<li><a href='https://blog.falafel.com/2014/03/'>March 2014</a>&nbsp;(28)</li>
	<li><a href='https://blog.falafel.com/2014/02/'>February 2014</a>&nbsp;(26)</li>
	<li><a href='https://blog.falafel.com/2014/01/'>January 2014</a>&nbsp;(7)</li>
	<li><a href='https://blog.falafel.com/2013/12/'>December 2013</a>&nbsp;(5)</li>
	<li><a href='https://blog.falafel.com/2013/11/'>November 2013</a>&nbsp;(6)</li>
	<li><a href='https://blog.falafel.com/2013/10/'>October 2013</a>&nbsp;(12)</li>
	<li><a href='https://blog.falafel.com/2013/09/'>September 2013</a>&nbsp;(19)</li>
	<li><a href='https://blog.falafel.com/2013/08/'>August 2013</a>&nbsp;(13)</li>
	<li><a href='https://blog.falafel.com/2013/07/'>July 2013</a>&nbsp;(13)</li>
	<li><a href='https://blog.falafel.com/2013/06/'>June 2013</a>&nbsp;(9)</li>
	<li><a href='https://blog.falafel.com/2013/05/'>May 2013</a>&nbsp;(12)</li>
	<li><a href='https://blog.falafel.com/2013/04/'>April 2013</a>&nbsp;(23)</li>
	<li><a href='https://blog.falafel.com/2013/03/'>March 2013</a>&nbsp;(11)</li>
	<li><a href='https://blog.falafel.com/2013/02/'>February 2013</a>&nbsp;(13)</li>
	<li><a href='https://blog.falafel.com/2013/01/'>January 2013</a>&nbsp;(8)</li>
	<li><a href='https://blog.falafel.com/2012/12/'>December 2012</a>&nbsp;(4)</li>
	<li><a href='https://blog.falafel.com/2012/11/'>November 2012</a>&nbsp;(4)</li>
	<li><a href='https://blog.falafel.com/2012/10/'>October 2012</a>&nbsp;(10)</li>
	<li><a href='https://blog.falafel.com/2012/09/'>September 2012</a>&nbsp;(12)</li>
	<li><a href='https://blog.falafel.com/2012/08/'>August 2012</a>&nbsp;(15)</li>
	<li><a href='https://blog.falafel.com/2012/07/'>July 2012</a>&nbsp;(15)</li>
	<li><a href='https://blog.falafel.com/2012/06/'>June 2012</a>&nbsp;(6)</li>
	<li><a href='https://blog.falafel.com/2012/05/'>May 2012</a>&nbsp;(8)</li>
	<li><a href='https://blog.falafel.com/2012/04/'>April 2012</a>&nbsp;(18)</li>
	<li><a href='https://blog.falafel.com/2012/03/'>March 2012</a>&nbsp;(608)</li>
		</ul>
		</div>    
				</div><!--/sidebar-->
				

						
			
		</div><!--/row-->

		

		<!--ascend only author/comment positioning-->
		<div class="row">

			
			

			  
		</div>


	   		
	</div><!--/container-->

</div><!--/container-wrap-->
	

<div id="footer-outer" data-midnight="light" data-using-widget-area="false">
	
	
	
	
		<div class="row" id="copyright">
			
			<div class="container">
				
				<div class="col span_5">
					
											<p>Copyright © 2017 Falafel Software Inc. </p>	
										
				</div><!--/span_5-->
				
				<div class="col span_7 col_last">
					<ul id="social">
						 <li><a target="_blank" href="https://twitter.com/falafelsoftware"><i class="icon-twitter"></i> </a></li> 						 <li><a target="_blank" href="https://www.facebook.com/falafelsoftware"><i class="icon-facebook"></i> </a></li> 																								 <li><a target="_blank" href="http://www.youtube.com/user/falafelsoftware"><i class="icon-youtube"></i> </a></li> 																		 <li><a target="_blank" href="https://blog.falafel.com/feed/rss/"><i class="icon-rss"></i> </a></li> 																		 <li><a target="_blank" href="https://plus.google.com/u/0/111519811494075346545"><i class="icon-google-plus"></i> </a></li> 																																															</ul>
				</div><!--/span_7-->
			
			</div><!--/container-->
			
		</div><!--/row-->
		
		
</div><!--/footer-outer-->



	<div id="slide-out-widget-area-bg" class="slide-out-from-right dark"></div>
	<div id="slide-out-widget-area" class="slide-out-from-right" data-back-txt="Back">

		
		<div class="inner">

		  <a class="slide_out_area_close" href="#"><span class="icon-salient-x icon-default-style"></span></a>


		   			   <div class="off-canvas-menu-container mobile-only">
			  		<ul class="menu">
					   <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1824"><a href="http://falafel.com">Falafel</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1826"><a href="http://falafel.com/consulting">Consulting</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1825"><a href="http://falafel.com/training">Training</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1827"><a href="http://falafel.com/company">Company</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1828"><a href="https://store.falafel.com/">Store</a></li>
		
					</ul>
				</div>
			
		</div>

		
	</div>


</div> <!--/ajax-content-wrap-->


	<a id="to-top" class=""><i class="icon-angle-up"></i></a>

<script>
		var advanced_ads_adsense_UID = false;
		/**
 * Check if an ad blocker is enabled.
 *
 * @param {function} callback A callback function that is executed after the check has been done.
 *                            The 'is_enabled' (bool) variable is passed as the callback's first argument.
 */
;advanced_ads_check_adblocker = ( function( callback ) {
	var pending_callbacks = [];
	var is_enabled = null;

	function RAF( RAF_callback ) {
		var fn = window.requestAnimationFrame
		|| window.mozRequestAnimationFrame
		|| window.webkitRequestAnimationFrame
		|| function( RAF_callback ) { return setTimeout( RAF_callback, 16 ); };

		fn.call( window, RAF_callback );
	}

	RAF( function() {
		// Create a bait.
		var ad = document.createElement( 'div' );
		ad.innerHTML = '&nbsp;';
		ad.setAttribute( 'class', 'ad_unit ad-unit text-ad text_ad pub_300x250' );
		ad.setAttribute( 'style', 'width: 1px !important; height: 1px !important; position: absolute !important; left: 0px !important; top: 0px !important; overflow: hidden !important;' );
		document.body.appendChild( ad );

		RAF( function() {
			var styles = window.getComputedStyle && window.getComputedStyle( ad );
			var moz_binding = styles && styles.getPropertyValue( '-moz-binding' );

			is_enabled = ( styles && styles.getPropertyValue( 'display' ) === 'none' )
			|| ( typeof moz_binding === 'string' && moz_binding.indexOf( 'about:' ) !== -1 );

			// Call pending callbacks.
			for ( var i = 0; i < pending_callbacks.length; i++ ) {
				pending_callbacks[ i ]( is_enabled );
			}
			pending_callbacks = [];
		} );
	} );

	return function( callback ) {
		if ( is_enabled === null ) {
			pending_callbacks.push( callback );
			return;
		}
		// Run the callback immediately
		callback( is_enabled );
	}
}());

(function() {
	var advadsTracker = function( name, UID ) {
		this.name = name;
		this.UID = UID;
		this.analyticsObject = null;
		var that = this;
		var data = {
			hitType: 'event',
			eventCategory: 'Advanced Ads',
			eventAction: 'AdBlock',
			eventLabel: 'Yes',
			nonInteraction: true,
			transport: 'beacon'
		};

		/**
		 * check if someone has already requested the analytics.js and created a GoogleAnalyticsObject
		 */
		this.analyticsObject = ( 'string' == typeof( GoogleAnalyticsObject ) && 'function' == typeof( window[GoogleAnalyticsObject] ) )? window[GoogleAnalyticsObject] : false;

		if ( false === this.analyticsObject ) {
			// No one has requested analytics.js at this point. Require it
			(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
				(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
				m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
			})(window,document,'script','https://www.google-analytics.com/analytics.js','_advads_ga');

			_advads_ga( 'create', that.UID, 'auto', this.name );
			_advads_ga( that.name + '.send', data );
		} else {
			// someone has already created a variable, use it to avoid conflicts.
			window.console && window.console.log( "Advanced Ads Analytics >> using other's variable named `" + GoogleAnalyticsObject + "`" );
			window[GoogleAnalyticsObject]( 'create', that.UID, 'auto', this.name );
			window[GoogleAnalyticsObject]( that.name + '.send', data );
		}
	}

	advanced_ads_check_adblocker( function( is_enabled ) {
		// Send data to Google Analytics if an ad blocker was detected.
		if ( is_enabled && 'string' === typeof advanced_ads_adsense_UID && advanced_ads_adsense_UID ) {
			new advadsTracker( 'advadsTracker', advanced_ads_adsense_UID );
		}
	} );
}());

		</script>        <script type="text/javascript">
        // <![CDATA[
        var disqus_shortname = 'falafelblogs';
        (function () {
            var nodes = document.getElementsByTagName('span');
            for (var i = 0, url; i < nodes.length; i++) {
                if (nodes[i].className.indexOf('dsq-postid') != -1 && nodes[i].parentNode.tagName == 'A') {
                    nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('data-dsqidentifier'));
                    url = nodes[i].parentNode.href.split('#', 1);
                    if (url.length == 1) { url = url[0]; }
                    else { url = url[1]; }
                    nodes[i].parentNode.href = url + '#disqus_thread';
                }
            }
            var s = document.createElement('script');
            s.async = true;
            s.type = 'text/javascript';
            s.src = '//' + disqus_shortname + '.disqus.com/count.js';
            (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
        }());
        // ]]>
        </script>
        <script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/jquery/ui/core.min.js?ver=1.11.4'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/jquery/ui/widget.min.js?ver=1.11.4'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/jquery/ui/position.min.js?ver=1.11.4'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/jquery/ui/menu.min.js?ver=1.11.4'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/wp-a11y.min.js?ver=4.9.2'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var uiAutocompleteL10n = {"noResults":"No results found.","oneResult":"1 result found. Use up and down arrow keys to navigate.","manyResults":"%d results found. Use up and down arrow keys to navigate.","itemSelected":"Item selected."};
/* ]]> */
</script>
<script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/jquery/ui/autocomplete.min.js?ver=1.11.4'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var MyAcSearch = {"url":"https:\/\/blog.falafel.com\/wp-admin\/admin-ajax.php"};
/* ]]> */
</script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/themes/salient/nectar/assets/functions/ajax-search/wpss-search-suggest.js'></script>
<script type='text/javascript' src='https://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=201804'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/themes/salient/js/prettyPhoto.js?ver=7.0.1'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/themes/salient/js/superfish.js?ver=1.4.8'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var nectarLove = {"ajaxurl":"https:\/\/blog.falafel.com\/wp-admin\/admin-ajax.php","postID":"139","rooturl":"https:\/\/blog.falafel.com","pluginPages":[],"disqusComments":"true"};
/* ]]> */
</script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/themes/salient/js/init.js?ver=7.0.7'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/comment-reply.min.js?ver=4.9.2'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-content/plugins/wp-post-series/assets/js/post-series.js?ver=1.1.0'></script>
<script type='text/javascript' src='https://blog.falafel.com/wp-includes/js/wp-embed.min.js?ver=4.9.2'></script>
				<script>(function () {
    if (jQuery('.wptbbarheaddiv').length) {
    	jQuery('body').addClass('wptopbarbody');   
    }
    
	jQuery('#sidebar .widget .tagcloud a').each(function () {
		var fontSize = this.style.fontSize;
		var $this = jQuery(this);
		$this.css('font-size', '');
		$this.css('cssText', 'font-size: ' + fontSize + ' !important');
	});
})();</script>
	

</body>
</html>