DDD – Where Does Data Import Task/Service Fit in Domain-Driven Design

Architecturedomain-driven-design

I'm currently trying to build my first solution following DDD principles.
Until recently everything was more or less clear, but now I have a task to import configuration data for my application and I am not sure what would be a best place to fit such a functionality…

I have a sales analysis application, and at some moments there is a need to renew price list data (add new/delist products, or update prices). So in one operation I would import price list data for all of the products.

I guess it could be treated as Price list renewal bounded context It could have an aggregate PriceListItem and could have a DomainService PriceListRenewalService, but this seems to be an anemic model (because this bounded context is about data import only – so it turns out to be plain CRUD).

Question

What would be correct way to model such a service (subdomain) and what would be a valid (according to DDD) place for such a service (Which layer? Should it have a Bounded Context or would it be ok that such a service works directly with database, since it's just a CRUD?)

Best Answer

I would argue your requirement has nothing to do with DDD. DDD is about solving complex business rules in complex business domain. There are no business rules in requirement you are trying to implement.

In context of DDD, your requirement will be part of Application Services layer and not part of any of the bounded contexts in the domain layer. As such, no rules or practices of DDD should apply to it. So thinking about it as different bounded context doesn't make sense.

Related Topic