Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DDD. Where do user configurable settings belong?

I'm working on my first "real" DDD application.

Currently my client does not have access to my domain layer and requests changes to the domain by issuing commands.

I then have a separate (flattened) read model for displaying information (like simple CQRS).

I'm now working on configuration, or specifically, settings that the user configures. Using a blog application as an example, the settings might be the blog title or logo.

I've developed a generic configuration builder that builds a strongly typed configuration object (e.g. BlogSettings) based on a simple key value pair collection. I'm stuck on whether these configuration objects are part of my domain. I need access to them from the client and server.

I'm considering creating a "Shared" library that contains these configuration objects. Is this the correct approach?

Finally where should the code to save such configuration settings live? An easy solution would be to put this code in my Domain.Persistence project, but then, if they are not part of the domain, should they really be there?

Thanks,

Ben

like image 397
Ben Foster Avatar asked Oct 11 '11 21:10

Ben Foster


People also ask

What is the full form of DDD with respect to microservice?

Domain-driven design (DDD) for building and decoupling microservices. Domain-driven design (DDD), first coined in a book by Eric Evans, is an approach used to build systems that have a complex business domain.

What is infrastructure layer in DDD?

The infrastructure layer is how the data that is initially held in domain entities (in memory) is persisted in databases or another persistent store. An example is using Entity Framework Core code to implement the Repository pattern classes that use a DBContext to persist data in a relational database.

What is domain-driven development in c#?

Domain-Driven Design(DDD) is a collection of principles and patterns that help developers craft elegant object systems. Properly applied it can lead to software abstractions called domain models. These models encapsulate complex business logic, closing the gap between business reality and code.

What is domain in Microservices?

A domain model contains clusters of different data entities and processes that can control a significant area of functionality, such as order fulfillment or inventory. A more fine-grained DDD unit is the aggregate, which describes a cluster or group of entities and behaviors that can be treated as a cohesive unit.


1 Answers

User configurable settings belong to domain if they are strongly typed and modeled based on ubiquitous language, i.e. 'BlogSettings'. The only difference between settings and other domain objects is that conceptually settings are 'domain singletons'. They don't have a life cycle like other Entities and you can only have one instance.

Generic configuration builder belongs to Persistence just like the code that is responsible for saving and reading settings.

like image 76
Dmitry Avatar answered Oct 12 '22 19:10

Dmitry