title: Dynamic lazyLoading - Entity Framework
body: <p>I have a sqlSever database, reverse engineered with EF 5</p>
  
  <p>By default, lazy Loading is disabled, I need to tell the context dynamically if related entities should be included or not (lazy loading) by passing a parameter to my method : </p>
  
  <pre><code> public static IEnumerable&lt;Products&gt; getProductsList(SearchQuery&lt;Product&gt; SearchQuery, bool isLazyLoading=false)
      {
          var context = new Context();
          var dataBaseInitializer = new DataBaseInitializer();
          dataBaseInitializer.InitializeDatabase(context);
          // if I need related entities, I Need to enable lazy loading
          context.Configuration.LazyLoadingEnabled = isLazyLoading;
          var ProductsRepository = new Repository&lt;Product&gt;(context);
          var ProductsList = ProductsRepository.Search(SearchQuery);
          return ProductsList;
      }
  </code></pre>
  
  <p>when i need the productList with no related entity, every thing is Ok, </p>
  
  <p>When passing parameter 'isLazyLoading' to true, I see that it's well token in the context configuration, but no related entity is loaded, </p>
  
  <p>I want to Avoid the "include" way ...</p>
  
  <p>any Idea how to fix this please ?</p>