<?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 : Cocktail/Temphire - Unit of Work &amp; Repository Architecture</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : Cocktail/Temphire - Unit of Work &amp; Repository Architecture</description>
  <pubDate>Sun, 19 Apr 2026 22:57:02 -700</pubDate>
  <lastBuildDate>Wed, 06 Feb 2013 05:46:16 -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=3979</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>Cocktail/Temphire - Unit of Work &amp; Repository Architecture :   Yep, you got it. BTW, FindAll...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3979&amp;PID=15812#15812</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> 3979<br /><strong>Posted:</strong> 06-Feb-2013 at 5:46am<br /><br />Yep, you got it. BTW, FindAll would be a redundant method. This functionality is already provided by AllAsync().]]>
   </description>
   <pubDate>Wed, 06 Feb 2013 05:46:16 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3979&amp;PID=15812#15812</guid>
  </item> 
  <item>
   <title>Cocktail/Temphire - Unit of Work &amp; Repository Architecture : Thank you for your reply. The...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3979&amp;PID=15810#15810</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1696" rel="nofollow">DanielK</a><br /><strong>Subject:</strong> 3979<br /><strong>Posted:</strong> 06-Feb-2013 at 1:37am<br /><br />Thank you for your reply.<br />The concept of interfaces is known but if working with demo applications it’s not always easy to understand if something was implemented just because for the sake of convenience.<br />However. If I understood you right. You recommend something like this, right?<br /><br />Thanks<br />Daniel<br /><br />namespace DomainServices.Repositories<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;public interface IStaffingResourceRepository : IRepository&lt;StaffingResource&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Task&lt;IEnumerable&lt;StaffingResource&gt;&gt; FindAll();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br />namespace DomainServices.Repositories<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;public class StaffingResourceRepository : Repository&lt;StaffingResource&gt;, IStaffingResourceRepository<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public StaffingResourceRepository(IEntityManagerProvider&lt;TempHireEntities&gt; entityManagerProvider)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: base(entityManagerProvider)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public new TempHireEntities EntityManager<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;get { return (TempHireEntities) base.EntityManager; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public Task&lt;IEnumerable&lt;StaffingResource&gt;&gt; FindAll()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get all StaffingResources <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var query = EntityManager.StaffingResources;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return query.ExecuteAsync();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected override IEntityQuery GetKeyQuery(params object&#091;&#093; keyValues)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return EntityManager.StaffingResources<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .Where(r =&gt; r.Id == (Guid) keyValues&#091;0&#093;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .Include(r =&gt; r.Addresses)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  .Include(r =&gt; r.PhoneNumbers);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br />namespace DomainServices<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;public interface IResourceMgtUnitOfWork : IUnitOfWork<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Factories<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IFactory&lt;StaffingResource&gt; StaffingResourceFactory { get; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Repositories<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IRepository&lt;AddressType&gt; AddressTypes { get; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IRepository&lt;State&gt; States { get; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IRepository&lt;PhoneNumberType&gt; PhoneNumberTypes { get; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IRepository&lt;RateType&gt; RateTypes { get; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IStaffingResourceRepository StaffingResources { get; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Services<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IStaffingResourceSearchService Search { get; }<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br />]]>
   </description>
   <pubDate>Wed, 06 Feb 2013 01:37:07 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3979&amp;PID=15810#15810</guid>
  </item> 
  <item>
   <title>Cocktail/Temphire - Unit of Work &amp; Repository Architecture : Well, the point of an interface...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3979&amp;PID=15806#15806</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> 3979<br /><strong>Posted:</strong> 05-Feb-2013 at 7:10pm<br /><br />Well, the point of an interface is always the same. To define an abstract contract that allows for different implementations of said contract. For example for unit testing you can substitute the Cocktail implementation of the repository with a fake implementation that returns&nbsp;hard-coded&nbsp;data or you can easily replace an existing repository with an&nbsp;optimized&nbsp;implementation if you run into performance problems later in the lifecycle without having to change the parts of your application that interact with the repository. Interfaces are a pretty fundamental concept in modern programming languages.&nbsp;<div><br></div><div>If you don't like the contract that IRepository&lt;T&gt; provides, then you simply create your own interface that either extends IRepository&lt;T&gt; or completely replaces it.&nbsp;</div>]]>
   </description>
   <pubDate>Tue, 05 Feb 2013 19:10:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3979&amp;PID=15806#15806</guid>
  </item> 
  <item>
   <title>Cocktail/Temphire - Unit of Work &amp; Repository Architecture : I am just studying the Temphire...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3979&amp;PID=15804#15804</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1696" rel="nofollow">DanielK</a><br /><strong>Subject:</strong> 3979<br /><strong>Posted:</strong> 05-Feb-2013 at 2:53pm<br /><br />I am just studying the Temphire reference application and came across a topic I do not fully understand.<br />Maybe you can bring some light on the problem and recommend a best practice approach.<br /><br />Let's say I would like to extend the StaffingResourceRepository by some custom data selection method, e.g.<br /><br />public async Task&lt;IEnumerable&lt;StaffingResource&gt;&gt; FindAll()<br />{<br />// Get all StaffingResources<br />var query = EntityManager.StaffingResources;<br />return await query.ExecuteAsync();<br />}<br /><br />In the StaffingResourceDetailViewModel I would like to use this method but I can't because<br />in the ResourceMgtUnitOfWork the StaffingResources is defined as IRepository&lt;StaffingResource&gt; and not as StaffingResourceRepository.<br /><br />Could you please explain why you use IRepository&lt;StaffingResource&gt; and not StaffingResourceRepository in the ResourceMgtUnitOfWork<br />and what is the best approach if I would like to use the "custom" StaffingResourceRepository in a ViewModel instead of the generic one.<br /><br />Thank you for your assistance<br />Daniel<br />]]>
   </description>
   <pubDate>Tue, 05 Feb 2013 14:53:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3979&amp;PID=15804#15804</guid>
  </item> 
 </channel>
</rss>