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


C# Zenject.DiContainer類代碼示例

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


DiContainer類屬於Zenject命名空間,在下文中一共展示了DiContainer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


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