当前位置: 首页>>代码示例>>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;未经允许,请勿转载。