title: How to feed IQueryable Data to Telerik Grid in Domain Driven Development DDD
body: <p>I want to do paging data in database side for telerik grid but Mapping data between layers prevent it in DDD architecture.</p>
  
  <p>How can I do it?</p>
  
  <p>Explanation:</p>
  
  <p>I have a Domain Model (<code>News</code>) in Project.Domain.cproj and a Data Model (<code>NewsDataModel</code>) in Project.Data.cproj.</p>
  
  <p>In ASP.Net MVC I have a Telerik Grid and need a method on Controller to feed data to it.</p>
  
  <pre><code>public ActionResult GridList()
  {
      return Json(new GridModel(_newsService.GetAll()));
  }
  </code></pre>
  
  <p>and <code>_newsService.GetAll()</code> is as follow :</p>
  
  <pre><code>public IQueryable&lt;News&gt; GetAll()
  {
      return _newsRepository.GetAll().AsEnumerable().Select(ToDomainModel).AsQueryable();
  }
  </code></pre>