Dependency injection with NHibernate objects

前端 未结 3 882
北海茫月
北海茫月 2020-12-05 16:08

I am wondering how to tell NHibernate to resolve dependencies on my POCO domain objects.

I figured out that methods like CalculateOrderTax should be in the Domain ob

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 16:54

    As no-one seems to be able to answer your question at the moment I thought I'd suggest restructuring your code to remove the need for the Order to calculate it's own tax.

    You could delegate it to a OrderTaxService which takes an Order object and returns an OrderValue object or something along those lines.

    This will keep the logic in your domain but remove the need to attach it to your Order objects.

提交回复
热议问题