Search code examples
architecturedomain-driven-designonion-architecture

Location of Shared Kernel in Onion Architecture


I'm creating an application using Onion Architecture for the first time. All the concepts of the Onion Architecture make perfect sense to me so far but what I'm wondering is, where do you place Domain Driven Design's "Shared Kernel" within the Onion Architecture?

I've seen some people say it should go in the outer ring of the the Onion, where the Infrastructure lies. Does this seem right as I'd tend to put my abstract ValueObject class in the Shared Kernel but due to the Onion Architecture's constraints, I technically wouldn't be able to derive from the ValueObject class in my inner Domain layer.

Any ideas for best practice with this?


Solution

  • Put your "Shared kernel" in Domain Layer. This kernel share your domain model between many bounded contexts, and there no need some translation mechanism between contexts