Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not quite sure what do you mean by Aggregate Root. As far as I know the Repository Pattern usually works with a cluster of objects that are part of your domain model, in DDD this usually refers as <a href="https://web.archive.org/web/20110503184234/http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/10/08/the-repository-pattern.aspx" rel="nofollow">aggregates</a>. How do you access you objects from a repository depends on what kind of data access layer you use in you application. I usually use NHibernate as and ORM that manages all the relationships between my classes and database tables, so when I implement a repository I can use any objects that are a part of my domain and access them as needed.</p> <p>Here is an example of a repository that uses different objects:</p> <pre><code>public interface IStoryRepository : IRepository&lt;Story&gt; { List&lt;Image&gt; GetStoryImage(int id); List&lt;FacebookUser&gt; GetFbUserById(string id); } public class StoryRepository : Repository&lt;Story&gt;, IStoryRepository { public List&lt;Image&gt; GetStoryImage(int id) { var criteria = Session.CreateCriteria(typeof(Image)) .Add(Restrictions.Eq("Id", id)) .SetResultTransformer(new DistinctRootEntityResultTransformer()); return criteria.List&lt;Image&gt;() as List&lt;Image&gt;; } public List&lt;FacebookUser&gt; GetFbUserById(string id) { var criteria = Session.CreateCriteria(typeof(FacebookUser)) .Add(Restrictions.Eq("Id", id)) .SetResultTransformer(new DistinctRootEntityResultTransformer()); return criteria.List&lt;FacebookUser&gt;() as List&lt;FacebookUser&gt;; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload