I'm new to DDD so please forgive me if I'm not using the terms correctly.
I am Using C# MS/SQL and NHibernate.
I have a class call Payment and this payment has a PaymentCurrency each of these is an entity in the database.
OK. In my Domain Model I want to be able to create Payment as Either
Payment p = new Payment( 100 ) // automatically uses the default currency (defined in the db )
or
Payment p = new Payment( 100, Repository.GetCurrency( "JPY" ) ) // uses Yen defined in the db.
But it seems to me that in order to initialize my Domain Object with the dfault currency I need to pollute the domain model with knowledge of persistance. i.e. before I can completed the default Payment Constructor I need to load the Default Payment object from the db.
The constructor I visualize is somehting like
public Payment( int amount ) {
Currency = Repository.LoadDefaultCurrency(); // of cource defualt currency would be a singleton
}
public Payment( int amount, Currency c ) {
Currency = c; // this is OK since c is passed in from outside the domain model.
}
Thanks for your advice.