So for e.x I have an entity Payment and a config Payment settings.
class Payment
{
public Payment(PaymentSetting setting, ....other fields){}
internal Payment() /*strictly for the ORM**/
//Other properties and behaviour
}
class PaymentSettings
{
public Timespan TransactionTimeout {get; private set;}
//Other properties and behaviour
}
class Order /AggregateRoot*/
{
List<Payment> payments {get; private set;}
//Other properties and behaviour
}
There is no problem when I am going to create Payment object as I can inject the setting to constructor. But How do we inject config when the Order is loaded from DB?
I understand in the current example, Config is needed while creating the appointment only, and we can store the exact value as part of Payment object and revive it when needed. But what happens, if we need to know the latest config? Should add Methods to inject it from outside? Is it considered an acceptable practice wrt. DDD
TransactionTimeout
really a part of the domain, or is it ancillary to the implementation of a given repository?