使用Castle.Core找不到UseLog4Net或FromThisAssembly

时间:2018-06-30 16:45:21

标签: .net-core castle

我正尝试了解有关.Net Core和Castle依赖项注入以及控制反转的更多信息,但是在实现{{1}时,我UseLog4Net中都找不到LoggingFacility },也无法在CompositionRoot中的FromThisAssembly中实施我的安装程序。我在做什么错了?

CompositionRoot.cs

Classes

DomainInstaller.css

using Castle.Facilities.Logging;
using Castle.Windsor;

namespace PitchulaBeerNBurger.POS.CrossCuttingConcerns.DependencyInjection
{
    public class CompositionRoot
    {
        public virtual void ComposeApplication(IWindsorContainer container)
        {
            container.AddFacility<LoggingFacility>(f => f.UseLog4Net());

            container.Install(
                new Installers.CrossCuttingConcerns(),
                new Installers.Persistence(),
                new Installers.Domain(),
                new Installers.Business()
            );
        }
    }
}

已安装NuGet软件包:

using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;

namespace PitchulaBeerNBurger.POS.CrossCuttingConcerns.Installers
{
    public class Domain : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(Classes.FromThisAssembly()
                                      .Where(type => type.Name.EndsWith("Factory"))
                                      .LifestyleSingleton());
        }
    }
}

0 个答案:

没有答案