<?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 : Repository suggestion</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : Repository suggestion</description>
  <pubDate>Thu, 16 Apr 2026 16:29:29 -700</pubDate>
  <lastBuildDate>Wed, 24 Jul 2013 12:33:15 -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=4246</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>Repository suggestion : Mark provided a very good list...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16651#16651</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> 4246<br /><strong>Posted:</strong> 24-Jul-2013 at 12:33pm<br /><br />Mark provided a very good list of suggestions. The use of Include should be minimized for some of the very reasons that have already been stated. However, I don't think there's a need to change anything in Cocktail. It is the responsibility of your particular ViewModel to orchestrate the loading of the data and enable/disable the appropriate UI controls to prevent the user from performing an operation before the data is ready.&nbsp;<div><br></div><div>Only you as a developer know which load operations can be performed in parallel vs which ones need to be sequential in order to achieve the best possible performance.&nbsp;<span style="line-height: 1.4;">It is a good idea to add services to your UoW that encapsulate the more complex load operations.</span><div><br></div><div>Mark made a good point, that the save button should be disabled until all the required data has been loaded before allowing the user to perform a save. This can be done very easily if you encapsulate the logic in an asynchronous service method.&nbsp;</div></div>]]>
   </description>
   <pubDate>Wed, 24 Jul 2013 12:33:15 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16651#16651</guid>
  </item> 
  <item>
   <title>Repository suggestion : If your validate is simply on...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16650#16650</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 4246<br /><strong>Posted:</strong> 23-Jul-2013 at 8:39am<br /><br />If your validate is simply on save you could do something like:<br><br>If your save method is called "Save" you could modify your "CanSave" property to be based on if all the data is loaded or not<br>Load the main data first<br>Start your parallel queries or however you load the rest and then set the loaded property.<br><br>I would assume it's unlikely that a user could come in, make a change and want to save before the data is all loaded, but this way the save button gets enabled once the data is loaded, and then all your validation logic should work. <br><br>Just some thoughts!<br>]]>
   </description>
   <pubDate>Tue, 23 Jul 2013 08:39:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16650#16650</guid>
  </item> 
  <item>
   <title>Repository suggestion : Yes that is another possibilities...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16649#16649</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4246<br /><strong>Posted:</strong> 23-Jul-2013 at 8:19am<br /><br />Yes that is another possibilities but if I break my load and only load some navigation properties then when I active a specific part of my screen (using a tabcontrol for exemple) then my validate method located on the root entity might not work as expected.<div><span style="line-height: 1.4;">It won't know which related entitied been loaded or not and so what it have to validate (and I don't talk about the interceptors using some of those navigations properties).</span></div><div><span style="line-height: 1.4;"><br></span></div><div><br></div><div><br></div><div><br><div><div><br></div></div></div>]]>
   </description>
   <pubDate>Tue, 23 Jul 2013 08:19:37 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16649#16649</guid>
  </item> 
  <item>
   <title>Repository suggestion : Oh, ok. I was confused thinking...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16648#16648</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 4246<br /><strong>Posted:</strong> 23-Jul-2013 at 7:59am<br /><br />Oh, ok. I was confused thinking you were talking about search.<br><br>In our AccountRepository we use includes for some of the basic information needed.<br><br>in our Account screen we have multiple sections and we load extra data in either the OnActivate method, when the screen is first used, or the OnInitialize method so it loads at the start. This has helped our application response time a lot<br>]]>
   </description>
   <pubDate>Tue, 23 Jul 2013 07:59:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16648#16648</guid>
  </item> 
  <item>
   <title>Repository suggestion : hi smi-mark,Of course I already...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16647#16647</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4246<br /><strong>Posted:</strong> 23-Jul-2013 at 6:27am<br /><br />hi smi-mark,<div><br></div><div>Of course I already iuse the projection when I need to show a selection list.</div><div><br></div><div>My point was more about the edition of an entity (you can't use projection there). When you follow the pattern used in temphire, you create a specific repository for the root entity when you want to edit it. This repository have to include all the related entity you might be able to modify on your screen. This is done with the method Include() which is well known to be slow with EF.</div><div>So instead of doing many include, I would prefer to have x query running in parallel which should be in some case faster.</div><div><br></div><div><br></div><div>Regards,</div>]]>
   </description>
   <pubDate>Tue, 23 Jul 2013 06:27:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16647#16647</guid>
  </item> 
  <item>
   <title>Repository suggestion :  Have you thought about using...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16646#16646</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 4246<br /><strong>Posted:</strong> 23-Jul-2013 at 6:19am<br /><br />Have you thought about using projections? Here is a snippet of what we do in one of our search screens<br><br><table width="99%"><tr><td class="BBquote"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static IQueryable&lt;AccountListItem&gt; ToAccountListItemQuery(this IQueryable&lt;Model.Account&gt; query)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return query.Select(a =&gt; new AccountListItem<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AccountId = a.AccountId,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AccountNumber = a.AccountNumber,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PrimaryOwner = a.AccountOwners.Where(ao =&gt; ao.IsPrimary).Select(ao =&gt; ao.Owner).FirstOrDefault(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PrimaryOwnerAddress = a.AccountOwners.Where(ao =&gt; ao.IsPrimary).SelectMany(ao =&gt; ao.Owner.OwnerAddresses).Where(oa =&gt; oa.IsPrimary).Select(oa =&gt; oa.Address).FirstOrDefault(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StreetNumber = a.StreetNumber,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StreetName = a.StreetName,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; City = a.City, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PostalCode = a.PostalCode<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></td></tr></table><br><br>I take several properties on the account and a few of the related entities.<br><br>I call the FindAsync method on the repository with my selector (above method) and then I can pass my filter and order by clauses. If you'd like I'd be happy to post some code samples. <br><br>In some cases we have to actually calculate balances, so we actually have a remote method on the server that runs the queries, calculates anything it needs to and returns just the projection to the client.<br>]]>
   </description>
   <pubDate>Tue, 23 Jul 2013 06:19:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16646#16646</guid>
  </item> 
  <item>
   <title>Repository suggestion : Hi,In my Repositories, I have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16645#16645</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4246<br /><strong>Posted:</strong> 23-Jul-2013 at 4:23am<br /><br /><div>Hi,</div><div><br></div><div>In my Repositories, I have many Root Entities which load few RelatedEntityList.&nbsp;</div><div>Right now I am overriding the GetKeyQuery and&nbsp;<span style="line-height: 1.4;">add many include to my base query. In some case this is becoming an issue as the query aggregate a LOT of data since all is done&nbsp;</span><span style="line-height: 1.4;">in one query.</span></div><div>Instead of using Includes, I would like to be able to execute some queries in order to load subproperties faster, and avoid EF&nbsp;<span style="line-height: 1.4;">generating a huge single SQL query with hundreds of fields.</span></div><div><br></div><div>Could it be possible to have this feature in cocktail ?</div><div><br></div><div>I had the same issue in one of my search repository and I did it like this :</div><div><br></div><div>public class VirtualSearchRepository&lt;TResult&gt; : IVirtualSearchRepository&lt;TResult&gt;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; where TResult : class</div><div>{</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; protected virtual IEntityQuery&lt;TResult&gt; DefineQuery()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return null;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; protected virtual Task&lt;IEntityQuery&lt;TResult&gt;&gt; DefineQueryAsync()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var tcs = new TaskCompletionSource&lt;IEntityQuery&lt;TResult&gt;&gt;();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tcs.SetResult(DefineQuery());</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return tcs.Task;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; public async Task&lt;IEnumerable&lt;TResult&gt;&gt; AllAsync(Action&lt;TQueryOptions&gt; queryOptions = null, Func&lt;IQueryable&lt;TResult&gt;, IOrderedQueryable&lt;TResult&gt;&gt; orderBy = null, Action&lt;IFetchOptions&lt;TResult&gt;&gt; fetchOptions = null)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var qry = await DefineQueryAsync();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return await qry.ExecuteAsync();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>}</div><div><br></div><div><br></div><div>that way, If I override the method "IEntityQuery&lt;TResult&gt; DefineQuery()" I am in the exact same situation as with cocktail,</div><div>I define my query and can add few include if this solution is fast enought for me.</div><div>But if having multiple query is faster, I just have to override the other method "Task&lt;IEntityQuery&lt;TResult&gt;&gt; DefineQueryAsync()"</div><div><br></div><div>exemple :</div><div><br></div><div>private async Task&lt;Customer&gt; GetCustomer(int keyValue)</div><div>{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var taskCustomer = new EntityKey(typeof(Customer), keyValue).ToQuery().With(manager).ExecuteAsync();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var taskOrders = new EntityQuery&lt;Order&gt;().With(manager)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Where(p =&gt; p.Customer_Id == keyValue)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ExecuteAsync();</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; await TaskEx.WhenAll(taskCustomer, taskOrders);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (Customer)taskCustomer.Result.Cast&lt;object&gt;().ToList().First();</div><div>}</div><div><br></div><div>In my UnitOfWork I have to add this to not have the RelatedEntityList in the Pending mode:</div><div><br></div><div>Manager.MetadataStore.GetEntityMetadata(typeof(Customer))</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .NavigationProperties.First(p =&gt; p.Name.Equals(customer.EntityPropertyNames.Orders))</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ReferenceStrategy = EntityReferenceStrategy.NoLoad;</div><div><br></div><div><br></div><div><br></div><div>If you think that this feature has nothing to do in Cocktail's code, could you at least define the following method as virtual in the Repository ?</div><div>public Task&lt;T&gt; WithIdAsync(object&#091;&#093; keyValues, CancellationToken cancellationToken)</div><div><br></div><div><br></div><div>regards</div><div><br></div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Tue, 23 Jul 2013 04:23:31 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4246&amp;PID=16645#16645</guid>
  </item> 
 </channel>
</rss>