public static ICollection <FetchAttribute> GetAttributes(this XElement element) { if (element.Element("all-attributes") != null) { return(FetchAttribute.All); } if (element.Element("no-attrs") != null) { return(FetchAttribute.None); } return(FetchAttribute.Parse(element.Elements("attribute"))); }
public static ICollection <FetchAttribute> GetAttributes(this JToken element) { if (element["all-attributes"] != null && element["all-attributes"].Value <bool>()) { return(FetchAttribute.All); } if (element["no-attrs"] != null && element["no-attrs"].Value <bool>()) { return(FetchAttribute.None); } var attributes = element["attributes"] as JArray; if (attributes != null) { return(attributes.Select(attribute => FetchAttribute.Parse(attribute)).ToList()); } return(new List <FetchAttribute>()); }