本文整理汇总了C#中Zenject.DiContainer类的典型用法代码示例。如果您正苦于以下问题:C# DiContainer类的具体用法?C# DiContainer怎么用?C# DiContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DiContainer类属于Zenject命名空间,在下文中一共展示了DiContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MethodProviderUntyped
public MethodProviderUntyped(
Func<InjectContext, object> method,
DiContainer container)
{
_container = container;
_method = method;
}
开发者ID:Soren025,项目名称:Zenject,代码行数:7,代码来源:MethodProviderUntyped.cs
示例2: GetDependencies
static List<Type> GetDependencies(
DiContainer container, Type type)
{
var dependencies = new List<Type>();
foreach (var contractType in container.GetDependencyContracts(type))
{
List<Type> dependTypes;
if (contractType.FullName.StartsWith("System.Collections.Generic.List"))
{
var subTypes = contractType.GetGenericArguments();
Assert.IsEqual(subTypes.Length, 1);
var subType = subTypes[0];
dependTypes = container.ResolveTypeAll(subType);
}
else
{
dependTypes = container.ResolveTypeAll(contractType);
Assert.That(dependTypes.Count <= 1);
}
foreach (var dependType in dependTypes)
{
dependencies.Add(dependType);
}
}
return dependencies;
}
开发者ID:terrehbyte,项目名称:RitualNow,代码行数:31,代码来源:ObjectGraphVisualizer.cs
示例3: AddToExistingGameObjectComponentProvider
public AddToExistingGameObjectComponentProvider(
GameObject gameObject, DiContainer container, Type componentType,
string concreteIdentifier, List<TypeValuePair> extraArguments)
: base(container, componentType, concreteIdentifier, extraArguments)
{
_gameObject = gameObject;
}
开发者ID:Soren025,项目名称:Zenject,代码行数:7,代码来源:AddToExistingGameObjectComponentProvider.cs
示例4: ProcessDecoratorInstallers
void ProcessDecoratorInstallers(DiContainer container, bool isBefore)
{
if (DecoratorInstallers == null)
{
return;
}
foreach (var installer in DecoratorInstallers)
{
Assert.IsNotNull(installer, "Found null installer in SceneDecoratorContext");
if (installer.enabled)
{
container.Inject(installer);
if (isBefore)
{
installer.PreInstallBindings();
}
else
{
installer.PostInstallBindings();
}
}
}
}
开发者ID:Soren025,项目名称:Zenject,代码行数:26,代码来源:SceneDecoratorContext.cs
示例5: MonoBehaviourSingletonProviderCreator
public MonoBehaviourSingletonProviderCreator(
DiContainer container,
SingletonRegistry singletonRegistry)
{
_singletonRegistry = singletonRegistry;
_container = container;
}
开发者ID:Aszan,项目名称:Zenject,代码行数:7,代码来源:MonoBehaviourSingletonProviderCreator.cs
示例6: GameObjectSingletonProviderCreator
public GameObjectSingletonProviderCreator(
DiContainer container,
SingletonRegistry singletonRegistry)
{
_singletonRegistry = singletonRegistry;
_container = container;
}
开发者ID:Aszan,项目名称:Zenject,代码行数:7,代码来源:GameObjectSingletonProviderCreator.cs
示例7: EmptyGameObjectProvider
public EmptyGameObjectProvider(
DiContainer container, string gameObjectName, string groupName)
{
_gameObjectName = gameObjectName;
_groupName = groupName;
_container = container;
}
开发者ID:Soren025,项目名称:Zenject,代码行数:7,代码来源:EmptyGameObjectProvider.cs
示例8: CreateInjectContext
public InjectContext CreateInjectContext(
DiContainer container, InjectContext currentContext, object targetInstance, string concreteIdentifier)
{
return new InjectContext(
container, MemberType, Identifier, Optional,
ObjectType, targetInstance, MemberName, currentContext, concreteIdentifier);
}
开发者ID:RainsSoft,项目名称:Zenject,代码行数:7,代码来源:InjectableInfo.cs
示例9: PrefabSingletonProvider
public PrefabSingletonProvider(
DiContainer container, Type concreteType, PrefabSingletonLazyCreator creator)
{
_creator = creator;
_container = container;
_concreteType = concreteType;
}
开发者ID:JonJam,项目名称:marveluniverse,代码行数:7,代码来源:PrefabSingletonProvider.cs
示例10: PrefabSingletonProvider
public PrefabSingletonProvider(
DiContainer container, Type instanceType, PrefabSingletonLazyCreator creator)
{
_creator = creator;
_container = container;
_instanceType = instanceType;
}
开发者ID:JoshFisk,项目名称:Zenject,代码行数:7,代码来源:PrefabSingletonProvider.cs
示例11: FinalizeBinding
public void FinalizeBinding(DiContainer container)
{
Assert.IsNotNull(_subFinalizer,
"Unfinished binding! Finalizer was not given.");
_subFinalizer.FinalizeBinding(container);
}
开发者ID:Soren025,项目名称:Zenject,代码行数:7,代码来源:BindFinalizerWrapper.cs
示例12: OutputObjectGraphForCurrentScene
public static void OutputObjectGraphForCurrentScene(
DiContainer container, IEnumerable<Type> ignoreTypes, IEnumerable<Type> contractTypes)
{
string dotFilePath = EditorUtility.SaveFilePanel("Choose the path to export the object graph", "", "ObjectGraph", "dot");
if (!dotFilePath.IsEmpty())
{
ObjectGraphVisualizer.OutputObjectGraphToFile(
container, dotFilePath, ignoreTypes, contractTypes);
var dotExecPath = EditorPrefs.GetString("Zenject.GraphVizDotExePath", "");
if (dotExecPath.IsEmpty() || !File.Exists(dotExecPath))
{
EditorUtility.DisplayDialog(
"GraphViz", "Unable to locate GraphViz. Please select the graphviz 'dot.exe' file which can be found at [GraphVizInstallDirectory]/bin/dot.exe. If you do not have GraphViz you can download it at http://www.graphviz.org", "Ok");
dotExecPath = EditorUtility.OpenFilePanel("Please select dot.exe from GraphViz bin directory", "", "exe");
EditorPrefs.SetString("Zenject.GraphVizDotExePath", dotExecPath);
}
if (!dotExecPath.IsEmpty())
{
RunDotExe(dotExecPath, dotFilePath);
}
}
}
开发者ID:4xisblack,项目名称:Zenject,代码行数:28,代码来源:ZenEditorUtil.cs
示例13: ProcessDecoratorInstallers
void ProcessDecoratorInstallers(DiContainer container, bool isBefore)
{
if (DecoratorInstallers == null)
{
return;
}
foreach (var installer in DecoratorInstallers)
{
if (installer == null)
{
Log.Warn("Found null installer in composition root");
continue;
}
if (installer.enabled)
{
container.Inject(installer);
if (isBefore)
{
installer.PreInstallBindings();
}
else
{
installer.PostInstallBindings();
}
}
}
}
开发者ID:zeljkokalezic,项目名称:Reactive-Space-Shooter,代码行数:30,代码来源:SceneDecoratorCompositionRoot.cs
示例14: SingletonLazyCreatorByInstance
public SingletonLazyCreatorByInstance(
SingletonId id, SingletonProviderMap owner, DiContainer container, object instance)
: base(id, owner)
{
Assert.That(instance != null || container.IsValidating);
_instance = instance;
}
开发者ID:JoshFisk,项目名称:Zenject,代码行数:7,代码来源:SingletonLazyCreatorByInstance.cs
示例15: StandardSingletonProviderCreator
public StandardSingletonProviderCreator(
DiContainer container,
SingletonMarkRegistry markRegistry)
{
_markRegistry = markRegistry;
_container = container;
}
开发者ID:Soren025,项目名称:Zenject,代码行数:7,代码来源:StandardSingletonProviderCreator.cs
示例16: SubContainerCreatorByMethod
public SubContainerCreatorByMethod(
DiContainer container,
Action<DiContainer> installMethod)
{
_installMethod = installMethod;
_container = container;
}
开发者ID:Soren025,项目名称:Zenject,代码行数:7,代码来源:SubContainerCreatorByMethod.cs
示例17: Test1
public void Test1()
{
NumInstalls = 0;
InitTest.WasRun = false;
TickTest.WasRun = false;
DisposeTest.WasRun = false;
var container = new DiContainer();
container.Bind(typeof(TickableManager), typeof(InitializableManager), typeof(DisposableManager))
.ToSelf().AsSingle().InheritInSubContainers();
// This is how you add ITickables / etc. within sub containers
container.BindAllInterfacesAndSelf<FooKernel>()
.To<FooKernel>().FromSubContainerResolve().ByMethod(InstallFoo).AsSingle();
var tickManager = container.Resolve<TickableManager>();
var initManager = container.Resolve<InitializableManager>();
var disposeManager = container.Resolve<DisposableManager>();
Assert.That(!InitTest.WasRun);
Assert.That(!TickTest.WasRun);
Assert.That(!DisposeTest.WasRun);
initManager.Initialize();
tickManager.Update();
disposeManager.Dispose();
Assert.That(InitTest.WasRun);
Assert.That(TickTest.WasRun);
Assert.That(DisposeTest.WasRun);
}
开发者ID:Soren025,项目名称:Zenject,代码行数:32,代码来源:TestFacadeSubContainer.cs
示例18: InstanceSingletonProviderCreator
public InstanceSingletonProviderCreator(
DiContainer container,
SingletonRegistry singletonRegistry)
{
_singletonRegistry = singletonRegistry;
_container = container;
}
开发者ID:Aszan,项目名称:Zenject,代码行数:7,代码来源:InstanceSingletonProviderCreator.cs
示例19: TypeSingletonLazyCreator
public TypeSingletonLazyCreator(
SingletonId id, TypeSingletonProviderCreator owner,
DiContainer container)
{
_container = container;
_id = id;
_owner = owner;
}
开发者ID:terrehbyte,项目名称:RitualNow,代码行数:8,代码来源:TypeSingletonLazyCreator.cs
示例20: Setup
public virtual void Setup()
{
_container = new DiContainer();
InstallBindings();
Validate();
_container.Inject(this);
}
开发者ID:4xisblack,项目名称:Zenject,代码行数:8,代码来源:TestWithContainer.cs
注:本文中的Zenject.DiContainer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论