<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : IPager&lt;T&gt;</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : IPager&lt;T&gt;</description>
  <pubDate>Fri, 10 Apr 2026 19:41:49 -700</pubDate>
  <lastBuildDate>Thu, 21 Nov 2013 06:38:41 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=4605</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>IPager&lt;T&gt; : Thank you for you answer.We have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4605&amp;PID=17252#17252</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1600" rel="nofollow">cypher</a><br /><strong>Subject:</strong> 4605<br /><strong>Posted:</strong> 21-Nov-2013 at 6:38am<br /><br />Thank you for you answer.<div><br></div><div>We have stripped out the generation of Predicates (Filters on an Entity) and pass it now into a SearchService, that has a Count And IPager Method.</div><div><br></div><div><br></div><div><div>&nbsp; &nbsp;/// &lt;summary&gt;</div><div>&nbsp; &nbsp; /// &nbsp; &nbsp; Predicate to filter the entities.</div><div>&nbsp; &nbsp; /// &lt;/summary&gt;</div><div>&nbsp; &nbsp; /// &lt;typeparam name="T"&gt;the Model/Projection to apply the filter on&lt;/typeparam&gt;</div><div>&nbsp; &nbsp; public interface IPredicate&lt;T&gt; : where T : IEntity</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; #region Public Methods</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; /// &nbsp; &nbsp; Applies the filter.</div><div>&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;returns&gt;&lt;/returns&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; Expression&lt;Func&lt;T, bool&gt;&gt; ApplyFilter(Expression&lt;Func&lt;T, bool&gt;&gt; filters);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; #endregion</div><div>&nbsp; &nbsp; }</div></div><div><br></div><div>Here is a sample implementation:</div><div><br></div><div><div>&nbsp;public class CustomerFreeTextPredicate : IPredicate&lt;Customer&gt;</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; #region Fields</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; private readonly string _searchTerm;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; #endregion</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; #region Constructors and Destructors</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; public CustomerFreeTextPredicate(string searchTerm)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _searchTerm = searchTerm;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // &nbsp;DisplayName = string.Format(Resources.CustomerFreeTextPredicate, _searchTerm);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; #endregion</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; #region IPredicate&lt;Customer&gt; Members</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; public string DisplayName { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; public Expression&lt;Func&lt;Customer, bool&gt;&gt; ApplyFilter(Expression&lt;Func&lt;Customer, bool&gt;&gt; filter)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; filter.And(</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x =&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (x.CustomerName.Contains(_searchTerm) || x.CustomerNumber.Contains(_searchTerm)) &amp;&amp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x.LegalEntityRefs.Any(</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ler =&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ler.LegalEntityID.Equals(VisUser.LegalEntityId) &amp;&amp; (ler.IsDeleted.HasValue &amp;&amp; ler.IsDeleted.Value == false) &amp;&amp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ler.IsActive.Equals(true)));</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; #endregion</div><div>&nbsp; &nbsp; }</div></div><div><br></div><div><br></div><div>That all works, due to you fantastic implementaion of IRepository&lt;T&gt; !</div>]]>
   </description>
   <pubDate>Thu, 21 Nov 2013 06:38:41 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4605&amp;PID=17252#17252</guid>
  </item> 
  <item>
   <title>IPager&lt;T&gt; : Unfortunately, there is not. EF...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4605&amp;PID=17250#17250</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 4605<br /><strong>Posted:</strong> 20-Nov-2013 at 12:58pm<br /><br />Unfortunately, there is not. EF doesn't provide an inline count. You either have to run a count query or fetch the last page to know how many total records there are. That's just how it is. I recommend not to use the Total properties from IPager&lt;&gt; and instead just make a call to CountAsync() to get the total count and use that to calculate the number of pages etc.&nbsp;]]>
   </description>
   <pubDate>Wed, 20 Nov 2013 12:58:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4605&amp;PID=17250#17250</guid>
  </item> 
  <item>
   <title>IPager&lt;T&gt; :  We have started to Implement...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4605&amp;PID=17246#17246</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1600" rel="nofollow">cypher</a><br /><strong>Subject:</strong> 4605<br /><strong>Posted:</strong> 20-Nov-2013 at 7:31am<br /><br /><div>We have started to Implement the IPagerRepository&lt;T&gt; with Cocktail.</div><div><br></div><div>The Implementation is straight forward with the help of you'r Documentation.</div><div><br></div><div>But we are really not happy, that we have to Query the complete last Page, in order to have the TotalAmount initalized in The&nbsp;</div><div>IPager&lt;T&gt;</div><div><br></div><div>We have traced the Querys on SQL Profiler, and found out, that we have to fire three Querys&nbsp;</div><div><br></div><div>1.(Count)&nbsp;</div><div>2. LastPage</div><div>3. FirstPage</div><div><br></div><div>To initialize the IPager&lt;T&gt; to show the Pager.TotalDataSourceItemCount.</div><div><br></div><div>This is really sad, because we would like to query the database for the cound, if the first query starts.</div><div><br></div><div><b>Is there a Way for you to implement the IPager&lt;T&gt; from Cocktail, to have it initialize (Count) if the Pager.TotalDataSourceItemCount == -1 without loading the last page?</b></div><div><br></div><div>We really want to avoid, loading the last page, just to initialize the pager (get the TotalSourceItem)</div><div><br></div><span style="font-size:10px"><br /><br />Edited by cypher - 20-Nov-2013 at 7:36am</span>]]>
   </description>
   <pubDate>Wed, 20 Nov 2013 07:31:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4605&amp;PID=17246#17246</guid>
  </item> 
 </channel>
</rss>