Guidelines for Organizing Solution Source Code (OO / DDD)

I am starting my first business project (.NET) and trying to follow the principles of DDD. Are there any recommendations or common templates for styling source code and namespaces?

For example, do your domain objects come in a namespace MyProject.Domainor something else? Do you separate specific implementations and interfaces? In different namespaces? Different folders? Different solutions?

I know that a lot of this is subjective and depends on the size of the project, but it would be useful to indicate a few pointers or suggestions in order to get started with a relatively small but expandable n-level project.

+3
source share
2 answers

There are many good ways to organize a DDD application solution, so be open to experimenting. I changed my mind several times. I think the details depend on the technology you use, but the overall organization remains the same.

  • One solution for limited context
  • One domain project containing the model (objects, value objects, repository interfaces, etc.).
  • One Domain.Persistence (or DataAccess) project containing NHibernate mappings, repository implementations, and NHibernate-specific types. If you have serious plans to create more than one save layer, you can name them Domain.Persistence ..
  • One application project containing application level code (services)
  • Windows

DDDSample.Net. DDD . , , :

  • CQRS
  • CQRS

, .

+2

, .

- , . :

  • .Core :

    .Data DAL

    .Repository

  • Company.Data - DAL

  • Company.Domain - .

  • . - .

  • . :

    .Data DAL,.Data.Mock

    .Repository ,.Repository.Mock .

    .Domain

AutoFac

+1

Source: https://habr.com/ru/post/1747178/


All Articles