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:
Here is my project structure:
Web
Application
DomainServices
Repositories
DomainModel
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.
Comments