Note that there are some explanatory texts on larger screens.

plurals
  1. POOne service for each entity?
    primarykey
    data
    text
    <p>Again - i'm confused about DDD things :)</p> <p>I have architeture (I'm still working on it) that in short hand looks like that:</p> <pre><code>DataLayer: EntityDao -&gt; Implementing domain layer interfaces (NHibernate) DomainLayer: EntityRepository -&gt; Repository for each entity with injected Dao DomainObjects/Entitys -&gt; Some logic UI ASP.Net MVC </code></pre> <p>And I'm right now in that point where I feel to create and use some Service class. I have some questions with that:</p> <p>1.Should I create at least one service for each entity/domain object ?</p> <p>2.a.Should services have "query" method like Find, FIndAll, FindAll(LINQQuery)?</p> <p>2.b.Should I stop to use Repositorys in upper layers (UI) to get sets ("Find"-like methods) of entity's and start to use only services?</p> <p>3.If answer on 2 question is No - Should I use Services and Repository in parallel fashion (When in UI I just need to get all entity's I use Repository.FindAll, when I need to get some "logical" list of that entity's i use Service.FindXXX method)?</p> <p>4.Somehow I feel that Repositorys don't fit in Domain layer - should I separate them somehow and in DOMAIN leave only domain specific objects like Entity's and Services ? If Yes - give me some structure example how to achieve that. </p> <p>Examples of some objects:</p> <p>Dao:</p> <pre><code>public class NHibernateDao&lt;T&gt; : IDao&lt;T&gt; { public NHibernateDao() { } public T Get(object id) { T entity = (T)NHibernateSession.Get(entityType, id); return entity; } public T Load(object id) { T entity = (T)NHibernateSession.Load(entityType, id); return entity; } public virtual T Update(T entity) { NHibernateSession.Update(entity); return entity; } ... </code></pre> <p>Repository:</p> <pre><code>public class BaseRepository&lt;T&gt;:IRepository&lt;T&gt; { private DataInterfaces.IDao&lt;T&gt; mDao; public virtual T Get(object id) { return mDao.Get(id); } public virtual void Delete(T entity) { mDao.Delete(entity); } public virtual T Update(T entity) { return mDao.Update(entity); } public virtual IQueryable&lt;T&gt; FindAll() { return mDao.FindAll(); } ... </code></pre> <p>Domain objects, at the moment , it's mainly get/set container - background of this question is to remove that anemic model. </p>
    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.
 

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