private string GetQueryNodeValue(IFactoryNode node, bool addToMatches = true) { var alias = string.Format("{0}{1}", node.Alias(), node.GetUniquePropertyValue()); if (_processedNodes.FirstOrDefault(e => e.Alias == alias) == null) { if (addToMatches) _requiredMatches.Add(new ProcessedNode { Alias = alias, Node = node }); _processedNodes.Add(new ProcessedNode { Alias = alias, Node = node }); } return alias; }
public FluentQueryBuilder Merge(IFactoryNode relatedFrom) { _mergeStack.AddLast(relatedFrom); return this; }
public FluentQueryBuilder Create(IFactoryNode relatedFrom) { _createStack.AddLast(relatedFrom); return this; }
public FluentQueryBuilder Replace(IFactoryNode relatedFrom, IFactoryRelationship relationshipToRemove, IFactoryNode relatedTo, IFactoryNode createFrom, IFactoryRelationship createRelationship, IFactoryNode createTo, IFactoryNode property) { _replaceStack.AddLast(new ReplaceQueueItem { RelatedFrom = relatedFrom, RelationshipToRemove = relationshipToRemove, RelatedTo = relatedTo, CreateFrom = createFrom, CreateRelationship = createRelationship, CreateTo = createTo, Property = property }); return this; }
public FluentQueryBuilder RelateTo(IFactoryNode relatedFrom, IFactoryRelationship relationship, IFactoryNode relatedTo) { _relateToStack.AddLast(new RelateToQueueItem { RelatedFrom = relatedFrom, Relationship = relationship, RelatedTo = relatedTo}); return this; }
private void ProcessMerge(IFactoryNode createObject) { var alias = GetQueryNodeValue(createObject, false); Add(QueryTypeEnum.Merge, createObject.NodeWithAlias(alias)); }
private void ProcessRelateTo(IFactoryNode relatedFrom, IFactoryRelationship relationship, IFactoryNode relatedTo) { if (relatedFrom == null || relatedTo == null) throw new ArgumentNullException("relatedFrom || relatedTo"); var relatedFromQueryItems = GetQueryNodeValue(relatedFrom); var relatedToQueryItems = GetQueryNodeValue(relatedTo); var createQuery = String.Format("{0}-{1}->{2}", relatedFromQueryItems, relationship.Relationship(), relatedToQueryItems); Add(QueryTypeEnum.Merge, createQuery); }