Dependency injection with NHibernate objects

前端 未结 3 878
北海茫月
北海茫月 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:55

    I agree with Garry that you should remove service dependencies from your domain objects as much as possible. Sometimes it makes sense, such as encryption/decryption. In that case you can hide it in the infrastructure using interception or IUserType. I think the latter is favorable when you can use it. This article shows in detail how to do it. I am doing this and it works quite fine.

提交回复
热议问题