Пример #1
0
        private void RegisterDependencies(StaffingPurhcaseConfig config,
                                          params IDependencyRegistrar[] dependencyRegistars)
        {
            var builder   = new ContainerBuilder();
            var container = builder.Build();

            // Infrastructure
            builder = new ContainerBuilder();
            builder.RegisterInstance(config).As <StaffingPurhcaseConfig>().SingleInstance();
            builder.RegisterInstance(this).As <IEngine>().SingleInstance();
            builder.Update(container);

            // Invoke other dependency registrars
            builder = new ContainerBuilder();
            foreach (var depRegistrar in dependencyRegistars)
            {
                depRegistrar.Register(builder);
            }
            builder.Update(container);

            // Set container manager
            _containerManager = new ContainerManager(container, new JobContextManager(container));
            //DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
        }
Пример #2
0
 public void Initialize(StaffingPurhcaseConfig config, params IDependencyRegistrar[] dependencyRegistars)
 {
     RegisterDependencies(config, dependencyRegistars);
 }