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

后端 未结 6 1759
再見小時候
再見小時候 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:11

    Philip,

    Thanks for your answer!

    B and C:

    It's good to know that this kind of functionality is available. I suppose a more important question is whether what i'm trying to do is in fact common practice and whether it's considered good practice. i.e.

    1. Have a container resolve and inject dependencies that have been pre-populated using a persistence framework (e.g. NHibernate) and
    2. Have the container inject concrete implementation of abstract dependencies where the concrete implementation are determined at runtime.

    Also, in IoC/DI/NHibernate terminology, does what i'm talking about, have a particular name? Is it, for example, one of the features listed in this comparison or this comparison of .net IoC frameworks? I'd like to read about whether other IoC frameworks (like Castle Windsor) include these functionalities like LinFu does but i don't know whether what i'm describing has a particular name so i don't know what to search for :)

    A:

    In terms of best practice (i.e. loose coupling, testing etc...), would it be better to remove the service dependency from the domain object or leave it there?

    Thanks

    Matthew

提交回复
热议问题