Unity WCF配置

时间:2016-04-14 09:44:11

标签: wcf dependency-injection

您好我正在尝试将Unity依赖模式实现到我的wcf项目中。我已经安装了所需的软件包,并尝试将registeredtypes设置到容器中。我严格遵循codeplex网站上的示例,但我一直得到“WcfServiceFactory没有实现继承的抽象成员ConfigureContainer”。这有点奇怪,因为我在servicefactory中覆盖了它。我看了一下示例项目,但我似乎无法找到我做错了什么。请帮忙!

    namespace WCFService
{
    public class WcfServiceFactory : UnityServiceHostFactory
    {
        protected override void ConfigureContainer(IUnityContainer container)
        {
            // register all your components with the container here
            container
               .RegisterType<IPersonRepository, PersonRepository>();

        }
    }
}

1 个答案:

答案 0 :(得分:0)

最后,似乎安装的软件包存在问题。删除所有包并重新安装后,不再有问题...:S