本文整理汇总了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;
}
示例2: AddPreBindings
public void AddPreBindings(DiContainer container)
{
if (_beforeInstallHooks != null)
{
_beforeInstallHooks(container);
_beforeInstallHooks = null;
}
container.Install(PreInstallers);
ProcessDecoratorInstallers(container, true);
}
示例3: AddPostBindings
public void AddPostBindings(DiContainer container)
{
container.Install(PostInstallers);
ProcessDecoratorInstallers(container, false);
if (_afterInstallHooks != null)
{
_afterInstallHooks(container);
_afterInstallHooks = null;
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
示例7: InstallStandardInstaller
public static void InstallStandardInstaller(DiContainer container, GameObject rootObj)
{
container.Bind<GameObject>().ToInstance(rootObj).WhenInjectedInto<StandardUnityInstaller>();
container.Install<StandardUnityInstaller>();
}
示例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;
}
示例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;
}