예제 #1
0
        public static IAssimilate Eidetic(this IAssimilate assimilate, Action <EideticConfigurator> configure)
        {
            var config = new EideticConfigurator();

            configure(config);
            assimilate.Dependencies(x => x.For <IMemcachedClientConfiguration>()
                                    .Use(config.Configuration));

            var clientConfig = Assimilate.GetInstanceOf <IMemcachedClientConfiguration>();

            assimilate.Dependencies(
                x => x.For <MemcachedClient>().Use(new MemcachedClient(clientConfig)).AsSingleton());
            return(assimilate);
        }
예제 #2
0
        public static IAssimilate UseTestLogAdapter(this IAssimilate assimilate)
        {
            assimilate.Dependencies(x => x.For <ILogProvider>().Use <TestLogProvider>().AsSingleton());
            var logManager = GetInstanceOf <ILogManager>();

            logManager.Initialize();
            return(assimilate);
        }
예제 #3
0
        public static IAssimilate Daemon(this IAssimilate assimilate, Action <DaemonConfigurator> config)
        {
            var daemonConfiguration = new DaemonConfigurator();

            config(daemonConfiguration);
            assimilate
            .Dependencies(container => container.For <DaemonConfiguration>().Use(daemonConfiguration.Configuration));
            return(assimilate);
        }
예제 #4
0
        public HibernateConfigurator FromFactory(Action <FluentConfiguration> config)
        {
            var configuration = Fluently.Configure();

            config(configuration);
            _assimilate.Dependencies(
                x => x.For <ISessionFactory>().Use(configuration.BuildSessionFactory()).AsSingleton());
            return(this);
        }
예제 #5
0
 public HibernateConfigurator(IAssimilate assimilate)
 {
     _assimilate = assimilate;
     assimilate.Dependencies(x =>
                                 {
                                     x.For<ISessionContext>().Use<InMemoryContext>();
                                     x.For<ISessionManager>().Use<SessionManager>();
                                     x.For<ISessionModule>().Use<SessionModule>();
                                     x.For(typeof (IRepository<>)).Use(typeof (Repository<>));
                                 });
     HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
 }
예제 #6
0
        public static IAssimilate HttpServer(this IAssimilate assimilate, Action <HttpServerConfigurator> configure)
        {
            var configurator = new HttpServerConfigurator(new HttpServerConfiguration());

            configure(configurator);

            assimilate
            .Dependencies(x =>
            {
                var config = configurator.GetConfiguration();
                x.For <IHttpServerConfiguration>().Use(config);
                x.For <IHttpServer>().Use <HttpServer>();
                x.For <IAuthenticationValidator>().Use <WorthlessAuthenticationValidator>();

                if (config.AuthSchemes == AuthenticationSchemes.Basic)
                {
                    x.For <IHttpAuthChallenger>().Use <HttpBasicAuthChallenger>();
                }
            });

            return(assimilate);
        }