Where to put general purpose serialization class in domain driven design?

Herr Kater

I am trying to follow the DDD principles in my design, and I'm trying to keep my domain entities clean. I have to create serializer class (which uses json.net) and I don't know where to put it. I considered the following options:

  • Creating a utility project would be easy, but it would just drive a spike through the onion.
  • It is a bit similar to the Repositories because it contains actual implementation and has a dependecy (like the repo uses EF), but it does not store the object, just converts it.
  • It is not a domain service, as it does not contain business logic
  • Putting it into outer layer like Application or UI would not make too much sense to me.

Here is my project structure:

Web


Application


DomainServices

Repositories


DomainModel

L-Four

If you use onion architecture it means that you work with interfaces to avoid hard dependencies from your middle rings to the outer infrastructure; and the actual implementations are injected at run time.

Serializing functionality is an infrastructural concern, so the logic belongs there, but from your domain layer you program against its interfaces, and so you don't have a dependency to the actual serialization implementation, which is the whole idea of onion architecture: if later the serialization method changes, it only impacts infrastructure layer.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Domain driven design repository implementation in infrastructure layer

From Dev

Domain Driven Design - Domain or Security

From Dev

Where is the call to persistence in the domain driven design

From Dev

Access Control in Domain Driven Design

From Dev

Implementing Domain Driven Design Book Confusion

From Dev

How to handle Domain Driven Design when domain is dynamic / changes

From Dev

Domain Driven Design Bounded Context Domain Objects

From Dev

Domain Driven Design and batch processing

From Dev

Domain-Driven-Design Entities and Value Objects

From Dev

Implementing Domain Driven Design Cost

From Dev

Domain Driven Design - CQRS + ES usage

From Dev

Layers in Domain Driven Design

From Dev

Domain Driven Design in Node.js Application

From Dev

Domain Driven Design Auto Incremented Entity Key

From Dev

Implementing Paging and Sorting with Domain Driven Design

From Dev

Proper way to get aggregates in Domain Driven Design

From Dev

Implementing Domain-Driven Design and Transactions

From Dev

Where does the message bus service live in Domain Driven Design

From Dev

Domain Driven Design: infrastructure concern or domain concern?

From Dev

Domain Driven Design (DDD) and database generated reports

From Dev

Fetching associated aggregates in Domain driven Design

From Dev

Where to put security when using DDD - domain driven design

From Dev

Domain Driven Design - where should we put repositories?

From Dev

Implementing Domain Driven Design Cost

From Dev

Domain Driven Design: infrastructure concern or domain concern?

From Dev

Domain Driven Design. Entity type design

From Dev

Fetching associated aggregates in Domain driven Design

From Dev

Where to find Domain Driven Design consultants?

From Dev

How to add scheduled jobs in domain driven design

Related Related

  1. 1

    Domain driven design repository implementation in infrastructure layer

  2. 2

    Domain Driven Design - Domain or Security

  3. 3

    Where is the call to persistence in the domain driven design

  4. 4

    Access Control in Domain Driven Design

  5. 5

    Implementing Domain Driven Design Book Confusion

  6. 6

    How to handle Domain Driven Design when domain is dynamic / changes

  7. 7

    Domain Driven Design Bounded Context Domain Objects

  8. 8

    Domain Driven Design and batch processing

  9. 9

    Domain-Driven-Design Entities and Value Objects

  10. 10

    Implementing Domain Driven Design Cost

  11. 11

    Domain Driven Design - CQRS + ES usage

  12. 12

    Layers in Domain Driven Design

  13. 13

    Domain Driven Design in Node.js Application

  14. 14

    Domain Driven Design Auto Incremented Entity Key

  15. 15

    Implementing Paging and Sorting with Domain Driven Design

  16. 16

    Proper way to get aggregates in Domain Driven Design

  17. 17

    Implementing Domain-Driven Design and Transactions

  18. 18

    Where does the message bus service live in Domain Driven Design

  19. 19

    Domain Driven Design: infrastructure concern or domain concern?

  20. 20

    Domain Driven Design (DDD) and database generated reports

  21. 21

    Fetching associated aggregates in Domain driven Design

  22. 22

    Where to put security when using DDD - domain driven design

  23. 23

    Domain Driven Design - where should we put repositories?

  24. 24

    Implementing Domain Driven Design Cost

  25. 25

    Domain Driven Design: infrastructure concern or domain concern?

  26. 26

    Domain Driven Design. Entity type design

  27. 27

    Fetching associated aggregates in Domain driven Design

  28. 28

    Where to find Domain Driven Design consultants?

  29. 29

    How to add scheduled jobs in domain driven design

HotTag

Archive