Exemplo n.º 1
0
 protected void Application_Start()
 {
     DependencyContainerBuilder.ConfigureContainer();
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var builder = new DependencyContainerBuilder();

            builder.Register <ConsoleIntputProvider, IUserInputProvider>();
            var container      = builder.Build();
            var consoleManager = container.Resolve <SendingManager>();

            consoleManager.StartExecutionLoopAsync().GetAwaiter().GetResult();
        }
        public void SetUp()
        {
            var routeManager = Substitute.For <IRouteOptions>();

            IRouteOptions GetRouteOptions()
            => routeManager;

            _container = MockContainer();

            DependencyContainerBuilder.RegisterApiDependencies(GetRouteOptions, _container);
            _actualTypes = _container.RegisteredTypes;
        }
        /// <summary>
        ///     The class initialize.
        /// </summary>
        protected static void ClassInitialize()
        {
            //EffortProviderConfiguration.RegisterProvider();
            var containerBuilder   = new DependencyContainerBuilder(new HostUnityContainer());
            var container          = containerBuilder.BuildUnityContainer();
            var dependencyResolver = container.Resolve(typeof(IDependencyResolver), string.Empty) as IDependencyResolver;

            //DbInitializer dbInitializer = dependencyResolver.Resolve(typeof(DbInitializer)) as DbInitializer;

            //Database.SetInitializer(dbInitializer);

            MessageValidator = dependencyResolver.Resolve <IMessageValidator>();
        }
Exemplo n.º 5
0
        //TODOS: scope, register multiple consumers at once, show lazily loaded type, named parameters

        static void Main(string[] args)
        {
            using (var container = new DependencyContainerBuilder().Build())
            {
                using (var scope = container.BeginLifetimeScope())
                {
                    var mainApplication = scope.Resolve <MainApplication>();
                    mainApplication.Start();

                    Console.WriteLine("Press any key to exit Autofacs containers scope");
                    Console.ReadLine();
                }
            }

            Console.WriteLine();
            Console.WriteLine("Everything disposed, press any key to exit.");
            Console.ReadLine();
        }
Exemplo n.º 6
0
        internal static void Register(HttpConfiguration config)
        {
            var container = DependencyContainerBuilder.SetUpApiContainer(GetRouteOptions);

            config.DependencyResolver = container.Resolve <IDependencyResolver>();
        }