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


C# ODataPath.GetEnumerator方法代码示例

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


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

示例1: Initialize

        /// <summary>
        /// Initialize a UriParser. We have to initialize UriParser seperately for parsing path, because we may set BatchReferenceCallback before ParsePath.
        /// </summary>
        private void Initialize()
        {
            if (this.odataPath != null)
            {
                return;
            }

            // When parse path failed first time, the alias node would be not null, but already removed from query options, so do not set it in this case.
            if (this.ParameterAliasValueAccessor == null)
            {
                this.ParameterAliasValueAccessor = new ParameterAliasValueAccessor(queryOptions.GetParameterAliases());
            }

            this.odataPath = this.ParsePathImplementation();
            ODataPathSegment lastSegment = this.odataPath.LastSegment;
            ODataPathSegment previous = null;
            var segs = odataPath.GetEnumerator();
            int count = 0;
            while (++count < odataPath.Count && segs.MoveNext())
            {
            }

            previous = segs.Current;
            if (lastSegment != null)
            {
                // use previous segment if the last one is Key or Count Segment
                if (lastSegment is KeySegment || lastSegment is CountSegment)
                {
                    lastSegment = previous;
                }

                this.targetNavigationSource = lastSegment.TargetEdmNavigationSource;
                this.targetEdmType = lastSegment.TargetEdmType;
                if (this.targetEdmType != null)
                {
                    IEdmCollectionType collectionType = this.targetEdmType as IEdmCollectionType;
                    if (collectionType != null)
                    {
                        this.targetEdmType = collectionType.ElementType.Definition;
                    }
                }
            }

            InitQueryOptionDic();

            this.queryOptionParser = new ODataQueryOptionParser(this.Model, this.targetEdmType, this.targetNavigationSource, queryOptionDic)
                                        {
                                            Configuration = this.configuration
                                        };
        }
开发者ID:TomDu,项目名称:odata.net,代码行数:53,代码来源:ODataUriParser.cs


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