当前位置: 首页>>代码示例>>C#>>正文


C# ITreeNode.IsContainerCall方法代码示例

本文整理汇总了C#中ITreeNode.IsContainerCall方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeNode.IsContainerCall方法的具体用法?C# ITreeNode.IsContainerCall怎么用?C# ITreeNode.IsContainerCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITreeNode的用法示例。


在下文中一共展示了ITreeNode.IsContainerCall方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetComponentRegistrations

        public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            // This entire thing is one big hack. Need to come back to it one day :)
            // There is (currently) no way to create a pattern that would match the Bind() call with implicit 'this' in ReSharper SSR.
            // Therefore I'm only matching by the method name only, and later verifying that the method indeed belongs to Ninject, by
            // making sure the invocation's qualifier derived from global::Ninject.Syntax.IBindingRoot

            if (!registrationRootElement.IsContainerCall(NinjectBindingRootClrTypeName))
            {
                yield break;
            }

            var statement = registrationRootElement.GetParentExpression<IExpressionStatement>();
            if (statement == null)
            {
                yield break;
            }

            foreach (var toPattern in toPatterns)
            {
                var implementedByRegistration = toPattern.GetComponentRegistrations(statement.Expression)
                    .Cast<ComponentRegistration>()
                    .FirstOrDefault();

                if (implementedByRegistration != null)
                {
                    foreach (var registration in DoCreateRegistrations(statement.Expression).OfType<ComponentRegistration>())
                    {
                        registration.Implementation = implementedByRegistration.ServiceType;
                        yield return registration;
                    }
                }
            }
        }
开发者ID:hmemcpy,项目名称:AgentMulder,代码行数:34,代码来源:BindBasePattern.cs

示例2: GetComponentRegistrations

        public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            // todo this is duplicated, needs refactoring!
            // This entire thing is one big hack. Need to come back to it one day :)
            // There is (currently) no way to create a pattern that would match the Scan() call with implicit 'this' in ReSharper SSR
            // (i.e. a call to Scan being made withing a method, located in the Registry class)
            // Therefore I'm only matching by the method name only, and later verifying that the method indeed belongs to StructureMap, by
            // making sure the invocation's qualifier derived from global::StructureMap.Configuration.DSL.IRegistry

            if (!registrationRootElement.IsContainerCall(Constants.StructureMapRegistryTypeName))
            {
                yield break;
            }

            IInvocationExpression invocationExpression = registrationRootElement.GetInvocationExpression();
            if (invocationExpression == null)
            {
                yield break;
            }

            IStructuralMatchResult match = Match(invocationExpression);

            if (match.Matched)
            {
                var invocationExpressions = match.GetMatchedElementList("statements")
                                                 .OfType<IExpressionStatement>()
                                                 .WhereNotNull()
                                                 .Select(statement => statement.Expression)
                                                 .OfType<IInvocationExpression>()
                                                 .ToList();

                var registrations = (from expression in invocationExpressions
                                     from basedOnPattern in basedOnPatterns
                                     from registration in basedOnPattern.GetBasedOnRegistrations(expression)
                                     select registration).ToList();

                if (!registrations.Any())
                {
                    yield break;
                }

                var moduleRegistrations = (from expression in invocationExpressions
                                           from pattern in fromAssemblyPatterns
                                           from registration in pattern.GetComponentRegistrations(expression)
                                           select registration).ToList();

                foreach (var moduleRegistration  in moduleRegistrations)
                {
                    yield return new CompositeRegistration(registrationRootElement, registrations.Union(new[]
                    {
                        moduleRegistration
                    }));
                }
            }
        }
开发者ID:dpvreony-forks,项目名称:AgentMulder,代码行数:55,代码来源:ScanPatternBase.cs

示例3: GetComponentRegistrations

        public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            // todo this is duplicated from Ninject!
            // This entire thing is one big hack. Need to come back to it one day :)
            // There is (currently) no way to create a pattern that would match the For() call with implicit 'this' in ReSharper SSR
            // (i.e. a call to Foo being made withing a method, located in the Registry class)
            // Therefore I'm only matching by the method name only, and later verifying that the method indeed belongs to StructureMap, by
            // making sure the invocation's qualifier derived from global::StructureMap.Configuration.DSL.IRegistry

            if (!registrationRootElement.IsContainerCall(Constants.StructureMapRegistryTypeName))
            {
                yield break;
            }

            IInvocationExpression invocationExpression = registrationRootElement.GetInvocationExpression();
            if (invocationExpression == null)
            {
                yield break;
            }

            foreach (var usePattern in usePatterns)
            {
                var implementedByRegistration = usePattern.GetComponentRegistrations(invocationExpression)
                    .Cast<ComponentRegistration>()
                    .FirstOrDefault();

                if (implementedByRegistration != null)
                {
                    foreach (var registration in DoCreateRegistrations(invocationExpression).OfType<ComponentRegistration>())
                    {
                        registration.Implementation = implementedByRegistration.ServiceType;
                        yield return registration;
                    }
                }
            }
        }
开发者ID:hmemcpy,项目名称:AgentMulder,代码行数:36,代码来源:ForBasePattern.cs


注:本文中的ITreeNode.IsContainerCall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。