コード例 #1
0
        public static void Bootstrap()
        {
            var builder = new ContainerBuilder();

            builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
            builder.RegisterAssemblyTypes(typeof(IHandle <>).Assembly)
            .AsImplementedInterfaces();


            builder.RegisterAssemblyTypes(typeof(Denormalizer <>).Assembly)
            .AsImplementedInterfaces();

            //HACK
            builder.RegisterInstance(new Replay.Runner().Rebuild())
            .AsImplementedInterfaces()
            .SingleInstance();

            builder.RegisterModule <EventStoreModule>();
            builder.RegisterType <SignalREventDispatcher>()
            .AsImplementedInterfaces()
            .SingleInstance();

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

            builder.RegisterSource(new ContravariantRegistrationSource());

            var container = builder.Build();

            Command.UseContainer(container.BeginLifetimeScope());
            Denormalizer.UseContainer(container.BeginLifetimeScope());
            GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container);
        }
コード例 #2
0
 public Runner()
 {
     _container = BuildContainer();
     Denormalizer.UseContainer(_container.BeginLifetimeScope());
 }