How do I give access to user configured settings in DDD?
We have a configuration database which stores items as a bunch of key-value pairs. This doesn't really seem to fit the repository pattern, so how do I enable the user to access these configuration values?
Ideally I'd like to have separate classes for different groupings of configuration, ie.. BillingSettings, ReportSettings, TaxSettings.
It would seem odd to provide a separate repository for each of these, but I also want to maintain persistence ignorance for these settings classes.
What is the correct way of enabling access to configuration in DDD?
Domain-driven design (DDD) is a software development philosophy centered around the domain, or sphere of knowledge, of those that use it. The approach enables the development of software that is focused on the complex requirements of those that need it and doesn't waste effort on anything unneeded.
An aggregate is a domain-driven design pattern. It's a cluster of domain objects (e.g. entity, value object), treated as one single unit. A car is a good example. It consists of wheels, lights and an engine.
Domain-driven design (DDD) is a major software design approach, focusing on modelling software to match a domain according to input from that domain's experts. Under domain-driven design, the structure and language of software code (class names, class methods, class variables) should match the business domain.
What is DDD. Domain Driven Design is a software architecture to solve complex business problems. In DDD we identify the core domain and the domain logic. This approach needs continuous collaboration between developers and business experts.
What I typically do is just abstract the configuration using interfaces, e.g. IBillingConfiguration
, IReportConfiguration
, etc. The implementations of these are then what get passed into the relevant methods (or injected into the relevant objects).
Where the values comes from then really shouldn't matter. There are times when I do use a repository when storing the values in a database and then I'd have something like IConfigurationPropertyRepository
. It is somewhat of an awkward fit since a ConfiruationProperty
does not quite feel like a first-class citizen in the Entity world but it does seem to get the job done.
I would return some implementation of a IBillingConfiguration
that just gets the required property from an underlying collection or ConfigurationProperty
objects.
The relevant Get
and Save
methods for each I{Some}Configuration
would be implemented on the ConfigurationPropertyRepository
so that I only get/save that subset of the properties that need to be applied.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With