本文整理汇总了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
};
}