Note that there are some explanatory texts on larger screens.

plurals
  1. PODDD layers - Communication with entities
    text
    copied!<p>I'm getting started with domain driven design in asp.net mvc with c# and have a small sample project I am creating. I currently have a project for my domain layer, service layer, web, and also a console application. I am also using mongodb as my database.</p> <p>Currently my project has groups with people belonging to those groups which I have a class called <code>Group</code> and <code>Person</code> in my domain layer something like below (simplified). <code>Group</code> and <code>Person</code> also represent what the collection <code>Group</code> looks like in my mongodb database.</p> <pre><code>public class Group { public string Name { get; set; } public List&lt;Person&gt; People { get; set; } } public class Person { public string FirstName { get; set; } public string LastName { get; set; } } </code></pre> <p>The way I understand it is my website and my console application should be communicating to my services layer which acts as a sort of facade and should never see the domain layer? </p> <p>The thing I am unsure of is in my console application or website if I wanted to ask the service layer for all the groups normally I would expect that I would be asking for something like</p> <pre><code>var groupService = new GroupService(); List&lt;Group&gt; groups = groupService.GetGroups(); </code></pre> <p>Except in this instance as my group, and person classes are in the domain layer which my console app and website have no idea about I can't ask for a list of <code>Group</code> as my application has no idea what a <code>Group</code> is.</p> <p>Should my service layer be outputting the result as something else such as Json where it is up to my website and console app or say if I had an api that others could access to work out what to do with this data? or have I got something mixed up here?</p> <p>EDIT:</p> <p>In the future I plan to use my service and domain in an android app. I am thinking of using a restful service. I don't plan (at this stage) to have this as a public API.</p>
 

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