public static RequestUpdate MakeRequestUpdate(ServiceUpdateChangeset myUpdateChangeset) { #region PreRequest RequestGetVertices PreRequest = null; if (myUpdateChangeset.Expression == null) { if (myUpdateChangeset.VertexTypeName != null) { PreRequest = MakeRequestGetVertices(myUpdateChangeset.VertexTypeName, myUpdateChangeset.VertexIDs); } else { PreRequest = MakeRequestGetVertices(myUpdateChangeset.VertexTypeID, myUpdateChangeset.VertexIDs); } } else { PreRequest = MakeRequestGetVertices(myUpdateChangeset.Expression); } RequestUpdate Request = new RequestUpdate(PreRequest); if (!String.IsNullOrEmpty(myUpdateChangeset.Comment)) { Request.UpdateComment(myUpdateChangeset.Comment); } if (!String.IsNullOrEmpty(myUpdateChangeset.Edition)) { Request.UpdateEdition(myUpdateChangeset.Edition); } #endregion #region element collection if (myUpdateChangeset.AddedElementsToCollectionProperties != null) { foreach (var element in myUpdateChangeset.AddedElementsToCollectionProperties) { Request.AddElementsToCollection(element.Key, element.Value); } } if (myUpdateChangeset.RemovedElementsFromCollectionProperties != null) { foreach (var element in myUpdateChangeset.RemovedElementsFromCollectionProperties) { Request.RemoveElementsFromCollection(element.Key, element.Value); } } if (myUpdateChangeset.AddedElementsToCollectionEdges != null) { foreach (var element in myUpdateChangeset.AddedElementsToCollectionEdges) { Request.AddElementsToCollection(element.Key, element.Value.ToEdgePredefinition()); } } if (myUpdateChangeset.RemovedElementsFromCollectionEdges != null) { foreach (var element in myUpdateChangeset.RemovedElementsFromCollectionEdges) { Request.RemoveElementsFromCollection(element.Key, element.Value.ToEdgePredefinition()); } } #endregion #region Properties if (myUpdateChangeset.UpdatedStructuredProperties != null) { foreach (var item in myUpdateChangeset.UpdatedStructuredProperties) { Request.UpdateStructuredProperty(item.Key, item.Value); } } if (myUpdateChangeset.UpdatedUnstructuredProperties != null) { foreach (var item in myUpdateChangeset.UpdatedUnstructuredProperties) { Request.UpdateUnstructuredProperty(item.Key, item.Value); } } if (myUpdateChangeset.UpdatedUnknownProperties != null) { foreach (var item in myUpdateChangeset.UpdatedUnknownProperties) { Request.UpdateUnknownProperty(item.Key, item.Value); } } #endregion #region Update Edges if (myUpdateChangeset.UpdatedOutgoingEdges != null) { foreach (var Edge in myUpdateChangeset.UpdatedOutgoingEdges) { Request.UpdateEdge(Edge.ToEdgePredefinition()); } } if (myUpdateChangeset.UpdateOutgoingEdgesProperties != null) { foreach (var Edge in myUpdateChangeset.UpdateOutgoingEdgesProperties) { Request.UpdateEdge(Edge.ToSingleEdgeUpdateDefinition()); } } #endregion if (myUpdateChangeset.RemovedAttributes != null) { foreach (var item in myUpdateChangeset.RemovedAttributes) { Request.RemoveAttribute(item); } } return(Request); }
public List <ServiceVertexInstance> Update(SecurityToken mySecurityToken, Int64 myTransactionToken, ServiceUpdateChangeset myUpdateChangeset) { var Request = ServiceRequestFactory.MakeRequestUpdate(myUpdateChangeset); var Response = this.GraphDS.Update <IEnumerable <IVertex> >(mySecurityToken, myTransactionToken, Request, ServiceReturnConverter.ConvertOnlyVertices); return(Response.Select(x => new ServiceVertexInstance(x)).ToList()); }