本文整理汇总了C#中ODataVersion.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ODataVersion.Equals方法的具体用法?C# ODataVersion.Equals怎么用?C# ODataVersion.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ODataVersion
的用法示例。
在下文中一共展示了ODataVersion.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEntitiesCountFromFeed
/// <summary>
/// Get total count of entities in feed response.
/// </summary>
/// <param name="url">The input url.</param>
/// <param name="feed">The json object of feed response.</param>
/// <param name="version">The version of the service.</param>
/// <param name="RequestHeaders">The request headers.</param>
/// <param name="totalCount">The amount of the entities.</param>
/// <param name="odataCount">The odata.count value.</param>
private void GetEntitiesCountFromFeed(Uri url, JObject feed, ODataVersion version, IEnumerable<KeyValuePair<string, string>> RequestHeaders, ref int totalCount, out int odataCount)
{
int skiptoken = 0;
odataCount = 0;
string OdataNextLinkName = version.Equals(ODataVersion.V4) ? Constants.V4OdataNextLink : Constants.OdataNextLink;
foreach (var r in feed.Children<JProperty>())
{
if (r.Name.Equals(Constants.Value, StringComparison.Ordinal) && r.Value.Type == JTokenType.Array)
{
totalCount += ((JArray)r.Value).Count;
}
if (r.Name.Equals(version == ODataVersion.V4 ? Constants.V4OdataCount : Constants.OdataCount, StringComparison.Ordinal))
{
odataCount = Int32.Parse(r.Value.ToString().StripOffDoubleQuotes());
}
// When entities are more than one page.
if (r.Name.Equals(OdataNextLinkName, StringComparison.Ordinal))
{
string[] skiptokenValues = r.Value.ToString().StripOffDoubleQuotes().Split(new string[] { "skiptoken=" }, StringSplitOptions.None);
skiptoken = Int32.Parse(skiptokenValues[1]);
string nextLinkUrl = url + @"&$skiptoken=" + skiptoken.ToString();
Response response = WebHelper.Get(new Uri(nextLinkUrl), Constants.AcceptHeaderJson, RuleEngineSetting.Instance().DefaultMaximumPayloadSize, RequestHeaders);
JObject jo;
int tempCount = 0;
response.ResponsePayload.TryToJObject(out jo);
GetEntitiesCountFromFeed(url, jo, version, RequestHeaders, ref totalCount, out tempCount);
}
}
}