Unity Dependency Injection for WCF services

后端 未结 3 1318
借酒劲吻你
借酒劲吻你 2020-12-17 16:13

Can someone direct me to a good example of Unity Dependency Injection for WCF services? Any blog or msdn article will also help.

3条回答
  •  一整个雨季
    2020-12-17 17:09

    To inject dependencies into WCF services I had to implement a service host factory.

    I have found a step-by-step tutorial here.

    Basically you have to:

    1. Implement an IInstanceProvider to create services using the container
    2. Implement an IServiceBehavior to set the instance provider in the endpoint dispatcher
    3. Extend ServiceHost to add the new service behavior
    4. Extend ServiceHostFactory to create the new service host

提交回复
热议问题