Hi I have been trying to understand DDD for few weeks now. Its very confusing. I don't understand how I organize my projects. I have lot of questions on UnitOfWork, Repository, Associations and the list goes on...
Lets take a simple example.
Album and Tracks
Album: AlbumId, Name, ListOf Tracks
Tracks: TrackId, Name
Should i expose Tracks as a IList/IEnumerabe property on Album ? If that how do i add an album ? OR should i expose a ReadOnlyCollection of Tracks and expose a AddTrack method?
How do I load Tracks for Album [assuming lazy loading]? should the getter check for null and then use a repository to load the tracks if need be?
How do we organize the assemblies. Like what does each assembly have? Model.dll - does it only have the domain entities? Where do the repositories go? Interfaces and implementations both. Can i define IAlbumRepository in Model.dll? Infrastructure.dll : what should this have?
Where is unit of work defined? How do repository and unit of work communicate? Or should they? For example. If I need to add multiple tracks to album, again should this be defined as AddTrack on Album OR should there a method in the repository? Regardless of where the method is, how do I implement unit of work here?
Should the UI use Infrastructure..dll or should there be ServiceLayer?
Do my questions make sense?
Regards