public void RegisterServices(Container container)
        {
            container.RegisterSingleton<IConfiguration, EnvironmentAwareAppSettingsConfiguration>();
            container.RegisterSingleton(() =>
            {
                var config = container.GetInstance<IConfiguration>();
                var useRedis = config.Get("UseRedis");

                IDataServiceFactory factory;

                if (bool.Parse(useRedis))
                {
                    factory = new RedisDataServiceFactory(config);
                }
                else
                {
                    factory = new DirectDataServiceFactory();
                }

                return factory;
            });

            container.RegisterSingleton(() => container.GetInstance<IDataServiceFactory>().Create());
            container.RegisterSingleton<IAppSettings, AppSettings>();
        }
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterType<EnvironmentAwareAppSettingsConfiguration>().AsImplementedInterfaces().SingleInstance();

            builder.Register(c =>
            {
                var config = c.Resolve<IConfiguration>();
                var useRedis = config.Get("UseRedis");

                IDataServiceFactory factory;

                if (bool.Parse(useRedis))
                {
                    factory = new RedisDataServiceFactory(config);
                }
                else
                {
                    factory = new DirectDataServiceFactory();
                }

                return factory;
            }).AsImplementedInterfaces().SingleInstance();

            builder.Register(c => c.Resolve<IDataServiceFactory>().Create()).SingleInstance();

            builder.RegisterType<AppSettings>().AsImplementedInterfaces().SingleInstance();

            base.Load(builder);
        }