In my domain model I have an Entity called 'Inventory'. To make a certain move in inventory I need to access business level configuration to check.
I have following methods in the Inventory Entity
public class Inventory
{
// Some codes, properties and arguments are omitted for brevity.
public int InventoryId { get; set; }
public virtual Product Product { get; set; }
public virtual IList<InventoryTransaction> Transactions { get; set; }
public virtual IList<Stock> Stocks {get; set; }
// ........
public void purchase(double qty, decimal cost) { //....... }
public double QuantitiesOnHand() { //..... }
public decimal CostOfItemsOnHand() { //....... }
// This method require to access certain configuration in order to
// process the sale of item.
public decimal Sell(double qty, decimal cost) { //..... }
}
To process the sales I need to access certain configuration. Is it good practice to inject a configuration interface in order to process sale within this entity. Will it damage the purity of DDD? Or should I move only this 'Sell()' method to a Domain service layer?
EDIT :
public virtual IList<Stock> Stocks {get; set; } was added to the above class definition which holds the stock for the particular inventory item.