Exemple #1
0
        static void Main(string[] args)
        {
            var container = ConfigureContainer.Setup();
            var engine    = container.Resolve <IEngine>();

            engine.Run();
        }
 public void when_build_called_then_it_should_register_container_in_container()
 {
     ConfigureContainer.Set(_container.Object, _sut);
     _sut.Build();
     _container.Verify(
         x => x.RegisterAsSingleton(It.Is <IContainer>(x1 => _container.Object.Equals(_sut.Container))),
         Times.Once());
 }
        public ContainerRegistrationCatalog(RegistrationConvention convention, ConfigureContainer configureContainer)
        {
            _types = new DictionaryCache<Type, CatalogRegistration>(x => x.Registration.RegistrationType);
            _graph = new DependencyGraph<Type>();

            _convention = convention;
            _configureContainer = configureContainer;
        }
        protected void Application_Start(object sender, EventArgs e)
        {
            IUnityContainer applicationContainer = new UnityContainer();

            ConfigureContainer.Application(applicationContainer);

            ApplicationContainer = applicationContainer;
        }
        /// <summary>
        /// Registers the type mappings with the Unity container.
        /// </summary>
        /// <param name="container">The unity container to configure.</param>
        /// <remarks>
        /// There is no need to register concrete types such as controllers or
        /// API controllers (unless you want to change the defaults), as Unity
        /// allows resolving a concrete type even if it was not previously
        /// registered.
        /// </remarks>
        public static void RegisterTypes(IUnityContainer container)
        {
            // NOTE: To load from web.config uncomment the line below.
            // Make sure to add a Unity.Configuration to the using statements.
            // container.LoadConfiguration();

            // TODO: Register your type's mappings here.
            // container.RegisterType<IProductRepository, ProductRepository>();

            ConfigureContainer.InitializeContainer(container, false);
        }
        protected void Session_Start(object sender, EventArgs e)
        {
            IUnityContainer applicationContainer = ApplicationContainer;

            if (applicationContainer != null)
            {
                IUnityContainer sessionContainer
                    = applicationContainer.CreateChildContainer();
                ConfigureContainer.Session(sessionContainer);

                SessionContainer = sessionContainer;
            }
        }
Exemple #7
0
 public static Configure CastleContainer(this Configure config)
 {
     ConfigureContainer.Set(new CastleContainerAdapter(), config);
     return(config);
 }
Exemple #8
0
 public static Configure CastleContainer(this Configure config, IWindsorContainer windsorContainer)
 {
     ConfigureContainer.Set(new CastleContainerAdapter(windsorContainer), config);
     return(config);
 }
 public void when_build_called__then_it_should_register_and_call_all_default_component_configurators()
 {
     ConfigureContainer.Set(_container.Object, _sut);
 }
Exemple #10
0
 public ConfigureAnimotion(ConfigureContainer configureContainer, int configureOrder, bool isForced = false)
 {
     this.configureContainer = configureContainer;
     this.configureOrder     = configureOrder;
     this.isForced           = isForced;
 }
Exemple #11
0
 public override void Configure(Container container)
 {
     ConfigureAppHost?.Invoke(this);
     ConfigureContainer?.Invoke(container);
 }
Exemple #12
0
 public Form1()
 {
     ioc = ConfigureContainer.Configure().BeginLifetimeScope();
     InitializeComponent();
 }