本文整理匯總了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;
}