DI/IoC, NHibernate and help in getting them to work together

后端 未结 6 1758
再見小時候
再見小時候 2020-12-30 16:20

I\'m trying to get my head around DI/IoC, NHibernate and getting them to work nicely together for an application that i\'m developing. I\'m quite new to both NHibernate and

6条回答
  •  暖寄归人
    2020-12-30 17:12

    According to 'Domain Driven Design', your service would be a 'Domain Service', and it's ok for the rest of your domain to call it directly or depend on it.

    If you're going to use Nhibernate, check Spring.net, a very popular DI framework that provides you with DAOS, that already have a session injected on them. It also allows you to use declarative transactions (marking methods with attributes). The docs of the project are very very good.

    Last but not least, and don't get me wrong, I think you are using the technology just because (I don't see that you have the NEED for DI), this is cool if you're doing it to learn stuff, but wrong in every other case.

    Regards

提交回复
热议问题