문제

I have been reading about IoC lately, and I think it would definitely come in handy in the WCF web-service I am developing. However, it seems that Ninject, StructureMap and Spring.Net (I only did check these three) require the custom Factory attribute to be added to the *.svc file:

<%@ ServiceHost Language="C#" Debug="true" Service="SomeService" CodeBehind="SomeService.svc.cs" Factory="Ninject.Extensions.Wcf.NinjectServiceHostFactory" %>

The problem is that, due to the architecture of the system where the service will be deployed, I am already using a custom factory which is a must-have (a requirement) for this project. Can I somehow overcome this situation?

도움이 되었습니까?

해결책

Autofac also uses a custom factory, and I suspect they all will since this gives the IoC container a chance to be involved in the service creation process. Most (all?) of these are open source, so you might want to browse their source code and see if it would be possible to wrap the IoC custom factory in yours, or modify the source to integrate them.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top