コード例 #1
0
        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; 
        }
コード例 #2
0
 public FluentQueryBuilder Merge(IFactoryNode relatedFrom)
 {
     _mergeStack.AddLast(relatedFrom);
     return this;
 }
コード例 #3
0
 public FluentQueryBuilder Create(IFactoryNode relatedFrom)
 {
     _createStack.AddLast(relatedFrom);
     return this;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 public FluentQueryBuilder RelateTo(IFactoryNode relatedFrom, IFactoryRelationship relationship, IFactoryNode relatedTo)
 {
     _relateToStack.AddLast(new RelateToQueueItem { RelatedFrom = relatedFrom, Relationship = relationship, RelatedTo = relatedTo});
     return this;
 }
コード例 #6
0
        private void ProcessMerge(IFactoryNode createObject)
        {
            var alias = GetQueryNodeValue(createObject, false);
            Add(QueryTypeEnum.Merge, createObject.NodeWithAlias(alias));

        }
コード例 #7
0
        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);

        }