c# - DDD Bounded Contexts with Onion Architecture -


i have following onion architecture framework.

  • domain
    • entities - domain entities
    • interfaces - domain interfaces
    • services - domain services
  • infrastructure
    • data - fluent nhibernate persistence
    • interfaces - infrastructure interfaces
    • logging - interface logging in case want switch out logging library else.
    • dependency resolution - of ioc registrations goes in here.
  • services
    • interfaces - application service interfaces goes in here, implemented in ui project.
  • tests
    • infrastructure tests - testing infrastructure services etc.
    • domain tests - testing domain models , services
  • web
    • ui - user interface project implement application services, user interface, etc ...

with domain driven development 1 identify bounded contexts. of literature on internet states each bounded context needs abstracted own project or namespace.

  1. is approach incorrect having domain models in 1 project , domain services in project? matter not having different bounded context's in different namespaces or projects?
  2. if have model a used bounded context a, bounded context b, bounded context c, etc needs use exact same model a, allow them use exact same model, or create new model each bounded context?

i new ddd sorry if question dumb question. find myself understanding better if ask question , explanation answer.

any appreciated.

is approach incorrect having domain models in 1 project , domain services in project? matter not having different bounded context's in different namespaces or projects?

  1. different namespaces conceptual and practical solution, since otherwise have entity name collision when 2 neighboring concepts go same name in different subdomains.

    different projects/solutions more of organizational choice on top of that. makes things bit easier if separate teams work on bc's, , separate binaries mean bc's more independently deployable.

if have model used bounded context a, bounded context b, bounded context c, etc needs use exact same model a, allow them use exact same model, or create new model each bounded context?

  1. it require more domain analysis tell, whole point of bounded context being able view things totally different angle. in rare cases when

    • the exact same entity used in 3 different bc's
    • you don't see them evolving own way in future
    • the entity doesn't seem naturally belong in given bc

then might want use shared kernel pattern. otherwise, copy entity in each bc , let live own lives, or find entity's true bc , link id other bc's.