public static JObject AddOdataContext(this JObject jObject, string baseUri, string entitySetName, string entityKeyPredicate, string propertyName) { jObject.AddFirst(new JProperty("@odata.context", string.Format("{0}$metadata#{1}({2})/{3}", baseUri, entitySetName, entityKeyPredicate, propertyName))); return jObject; }
public static void AddElement(this XElement parent, string localName, object content = null, bool first = false, bool nonUnique = false) { if (nonUnique || !parent.Elements().Any(e => e.Name.LocalName == localName)) { var e = new XElement(XName.Get(localName, parent.Name.NamespaceName), content); if (first) parent.AddFirst(e); else parent.Add(e); } }
public static XDocument set_ProcessingInstruction(this XDocument xDocument, string target, string data) { var processingInstruntion = xDocument.processingInstruction(target); if (processingInstruntion.notNull()) processingInstruntion.Data = data; else { var newProcessingInstruction = new XProcessingInstruction(target, data);//"xsl-stylesheet", "type=\"text/xsl\" href=\"LogStyle.xsl\""); xDocument.AddFirst(newProcessingInstruction); } return xDocument; }
public static JObject AddOdataContext(this JObject jObject, string baseUri, string entitySetName) { jObject.AddFirst(new JProperty("@odata.context", baseUri + "$metadata#" + entitySetName + "/$entity")); return jObject; }
/// <summary> /// Merge in elements and attributes. New child elements and new attributes are imported to the source. Conflicts are ignored (not merged). /// </summary> /// <param name="source">the structure to add new elements and attributes to</param> /// <param name="toBeImported">what to import</param> /// <returns>The modified source.</returns> public static XElement ImportSubtree(this XElement source, XElement toBeImported) { if (toBeImported != null) { foreach (XAttribute targetAttribute in from targetAttribute in toBeImported.Attributes() let sourceAttribute = source.Attribute(targetAttribute.Name) where sourceAttribute == null select targetAttribute) { source.Add(targetAttribute); } foreach (XElement targetChild in toBeImported.Elements()) { XElement sourceChild = FindElement(source, targetChild); if (sourceChild != null && !HasConflict(sourceChild, targetChild)) { sourceChild.ImportSubtree(targetChild); } else { if (targetChild.Name.LocalName == "configSections") { source.AddFirst(targetChild); } else { source.Add(targetChild); } } } } return source; }
private static void filledByTail(this LinkedList<LiteItemModel> models, Task tail) { while (tail.Parent != null) { LiteItemModel item = new LiteItemModel(); item.FilledBy(tail); models.AddFirst(item); tail = tail.Parent; } LiteItemModel first = new LiteItemModel(); first.FilledBy(tail); models.AddFirst(first); }
public static void FilledByTail(this LinkedList<_DropdownlistLinkedNodeModel> models, Project tail) { while (tail.Parent != null) { _DropdownlistLinkedNodeModel nodeModel = new _DropdownlistLinkedNodeModel(); nodeModel.filledBy(tail); models.AddFirst(nodeModel); tail = tail.Parent; } _DropdownlistLinkedNodeModel firstNode = new _DropdownlistLinkedNodeModel { CurrentProject = new LiteItemModel() }; firstNode.CurrentProject.FilledBy(tail); models.AddFirst(firstNode); }