本文整理汇总了C#中Entry.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Entry.Add方法的具体用法?C# Entry.Add怎么用?C# Entry.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseEntry
private Entry ParseEntry(Dictionary<string, object> entry)
{
var ret = new Entry();
foreach (var property in entry)
{
if (property.Key == "__metadata")
{
var metadata = (Dictionary<string, object>)property.Value;
if (metadata.ContainsKey("id"))
{
ret.Id = metadata["id"].ToString();
}
}
else
{
var dic = property.Value as Dictionary<string, object>;
if (dic != null && dic.ContainsKey("__deferred"))
{
ret.Links.Add(this.ParseLink(property));
}
else
{
ret.Add(this.ParseProperty(property));
}
}
}
return ret;
}
示例2: ParseEntry
private Entry ParseEntry(Dictionary<string, object> entry)
{
var ret = new Entry();
foreach (var property in entry)
{
if (property.Key == "odata.metadata")
{
continue;
}
if (property.Value != null && property.Value.GetType() == typeof(Dictionary<string, object>))
{
ret.Links.Add(this.ParseLink(property));
}
else
{
ret.Add(this.ParseProperty(property));
}
}
return ret;
}
示例3: ParseEntry
private static Entry ParseEntry(XElement entry)
{
var ret = new Entry();
IEnumerable<XElement> columns;
ret.Links.AddRange(entry.Elements(AtomNS + "link").Select(ParseLink));
if (entry.Element(AtomNS + "content").HasElements)
{
columns = entry.Element(AtomNS + "content")
.Element(MetadataNS + "properties")
.Elements();
}
else
{
// sometimes, the OData service may not put the properties element into the content element
columns = entry.Element(MetadataNS + "properties")
.Elements();
}
ret.Id = entry.Elements(AtomNS + "id").FirstOrDefault().Value;
foreach (XElement property in columns)
{
ret.Add(ParseProperty(property));
}
return ret;
}