當前位置: 首頁>>代碼示例>>C#>>正文


C# DiContainer.Install方法代碼示例

本文整理匯總了C#中Zenject.DiContainer.Install方法的典型用法代碼示例。如果您正苦於以下問題:C# DiContainer.Install方法的具體用法?C# DiContainer.Install怎麽用?C# DiContainer.Install使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zenject.DiContainer的用法示例。


在下文中一共展示了DiContainer.Install方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateContainer

        public static DiContainer CreateContainer(bool allowNullBindings, GlobalCompositionRoot root)
        {
            Assert.That(allowNullBindings || root != null);

            var container = new DiContainer(root == null ? null : root.transform);

            container.AllowNullBindings = allowNullBindings;

            container.Bind<GlobalCompositionRoot>().ToInstance(root);
            container.Bind<CompositionRoot>().ToInstance(root);

            container.Install<StandardInstaller>();

            container.Install(GetGlobalInstallers());

            return container;
        }
開發者ID:4xisblack,項目名稱:Zenject,代碼行數:17,代碼來源:GlobalCompositionRoot.cs

示例2: AddPreBindings

        public void AddPreBindings(DiContainer container)
        {
            if (_beforeInstallHooks != null)
            {
                _beforeInstallHooks(container);
                _beforeInstallHooks = null;
            }

            container.Install(PreInstallers);

            ProcessDecoratorInstallers(container, true);
        }
開發者ID:4xisblack,項目名稱:Zenject,代碼行數:12,代碼來源:SceneDecoratorCompositionRoot.cs

示例3: AddPostBindings

        public void AddPostBindings(DiContainer container)
        {
            container.Install(PostInstallers);

            ProcessDecoratorInstallers(container, false);

            if (_afterInstallHooks != null)
            {
                _afterInstallHooks(container);
                _afterInstallHooks = null;
            }
        }
開發者ID:4xisblack,項目名稱:Zenject,代碼行數:12,代碼來源:SceneDecoratorCompositionRoot.cs

示例4: InstallSceneInstallers

        public static void InstallSceneInstallers(
            DiContainer container, IEnumerable<IInstaller> installers)
        {
            foreach (var installer in installers)
            {
                Assert.IsNotNull(installer, "Found null installer in composition root");

                if (installer.IsEnabled)
                {
                    container.Install(installer);
                }
            }
        }
開發者ID:JonJam,項目名稱:marveluniverse,代碼行數:13,代碼來源:CompositionRootHelper.cs

示例5: InstallSceneInstallers

        public static void InstallSceneInstallers(
            DiContainer container, IEnumerable<IInstaller> installers)
        {
            foreach (var installer in installers)
            {
                if (installer == null)
                {
                    Log.Warn("Found null installer in composition root");
                    continue;
                }

                if (installer.IsEnabled)
                {
                    container.Install(installer);
                }
            }
        }
開發者ID:IllusiveS,項目名稱:Asteroids,代碼行數:17,代碼來源:CompositionRootHelper.cs

示例6: CreateContainer

        public DiContainer CreateContainer(
            bool isValidating, DiContainer parentContainer, List<IInstaller> extraInstallers)
        {
            var container = new DiContainer(parentContainer);

            container.IsValidating = isValidating;

            container.Bind<CompositionRoot>().ToInstance(this);
            container.Bind<SceneCompositionRoot>().ToInstance(this);

            if (ParentNewObjectsUnderRoot)
            {
                container.Bind<Transform>(ZenConstants.DefaultParentId)
                    .ToInstance<Transform>(this.transform);
            }

            if (BeforeInstallHooks != null)
            {
                BeforeInstallHooks(container);
                // Reset extra bindings for next time we change scenes
                BeforeInstallHooks = null;
            }

            container.Install<StandardInstaller>();

            var allInstallers = extraInstallers.Concat(Installers).ToList();

            if (allInstallers.Where(x => x != null).IsEmpty())
            {
                Log.Warn("No installers found while initializing SceneCompositionRoot");
            }
            else
            {
                container.Install(allInstallers);
            }

            if (AfterInstallHooks != null)
            {
                AfterInstallHooks(container);
                // Reset extra bindings for next time we change scenes
                AfterInstallHooks = null;
            }

            return container;
        }
開發者ID:JoshFisk,項目名稱:Zenject,代碼行數:45,代碼來源:SceneCompositionRoot.cs

示例7: InstallStandardInstaller

 public static void InstallStandardInstaller(DiContainer container, GameObject rootObj)
 {
     container.Bind<GameObject>().ToInstance(rootObj).WhenInjectedInto<StandardUnityInstaller>();
     container.Install<StandardUnityInstaller>();
 }
開發者ID:IllusiveS,項目名稱:Asteroids,代碼行數:5,代碼來源:CompositionRootHelper.cs

示例8: CreateContainer

        public DiContainer CreateContainer(
            bool allowNullBindings, DiContainer parentContainer, List<IInstaller> extraInstallers)
        {
            var container = new DiContainer(this.transform, parentContainer);

            container.AllowNullBindings = allowNullBindings;

            container.Bind<SceneCompositionRoot>().ToInstance(this);
            container.Bind<CompositionRoot>().ToInstance(this);

            if (BeforeInstallHooks != null)
            {
                BeforeInstallHooks(container);
                // Reset extra bindings for next time we change scenes
                BeforeInstallHooks = null;
            }

            container.Install<StandardInstaller>();

            var allInstallers = extraInstallers.Concat(Installers).ToList();

            if (allInstallers.Where(x => x != null).IsEmpty())
            {
                Log.Warn("No installers found while initializing SceneCompositionRoot");
            }
            else
            {
                container.Install(allInstallers);
            }

            if (AfterInstallHooks != null)
            {
                AfterInstallHooks(container);
                // Reset extra bindings for next time we change scenes
                AfterInstallHooks = null;
            }

            return container;
        }
開發者ID:4xisblack,項目名稱:Zenject,代碼行數:39,代碼來源:SceneCompositionRoot.cs

示例9: CreateContainer

        public static DiContainer CreateContainer(bool isValidating, GlobalCompositionRoot root)
        {
            Assert.That(isValidating || root != null);

            var container = new DiContainer();

            container.IsValidating = isValidating;

            if (root != null)
            {
                container.Bind<Transform>(ZenConstants.DefaultParentId)
                    .ToInstance<Transform>(root.gameObject.transform);
            }

            container.Bind<CompositionRoot>().ToInstance(root);
            container.Bind<GlobalCompositionRoot>().ToInstance(root);

            container.Install<StandardInstaller>();
            container.Install(GetGlobalInstallers());

            return container;
        }
開發者ID:terrehbyte,項目名稱:RitualNow,代碼行數:22,代碼來源:GlobalCompositionRoot.cs


注:本文中的Zenject.DiContainer.Install方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。