/// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            kernel.Bind <IDistributedPizzaDbContext>().To <DistributedPizzaDbContext>();

            var mapperConfig = new MapperConfiguration(cfg =>
            {
                MapperConfigurationHelper.Build(cfg);
            });
            var mapper = mapperConfig.CreateMapper();

            kernel.Bind <IMapper>().ToConstant(mapper);
        }
Ejemplo n.º 2
0
        private static void ConfigureServices(IServiceCollection services)
        {
            //Logger
            var loggerFactory = new LoggerFactory();

            loggerFactory.AddNLog(new NLogProviderOptions {
                CaptureMessageTemplates = true, CaptureMessageProperties = true
            });

            var mapperConfig = new MapperConfiguration(cfg =>
            {
                MapperConfigurationHelper.Build(cfg);
            });
            var mapper = new Mapper(mapperConfig);

            NLog.LogManager.LoadConfiguration("nlog.config");
            services.TryAddSingleton <ILoggerFactory>(loggerFactory);
            services.TryAddSingleton <IMapper>(mapper);
        }