Esempio n. 1
0
        /// <summary>
        /// Executes the query plan recursivly
        /// </summary>
        /// <param name="myVertexType">The starting vertex type</param>
        /// <returns>An enumeration of vertices</returns>
        private IEnumerable <IVertex> Execute_private(IVertexType myVertexType)
        {
            #region current type

            ISonesIndex idx = null;

            if (_expressionIndex != null)
            {
                idx = _indexManager.GetIndex(_expressionIndex, _securityToken, _transactionToken);
            }
            else
            {
                idx = GetBestMatchingIdx(_indexManager.GetIndices(_property.Property, _securityToken, _transactionToken));
            }

            foreach (var aVertex in GetValues(idx, _constant)
                     .Select(aId => _vertexStore.GetVertex(
                                 _securityToken,
                                 _transactionToken,
                                 aId,
                                 myVertexType.ID,
                                 VertexEditionFilter,
                                 VertexRevisionFilter)))
            {
                yield return(aVertex);
            }

            #endregion

            #region child types

            foreach (var aChildVertexType in myVertexType.GetDescendantVertexTypes())
            {
                foreach (var aVertex in Execute_private(aChildVertexType))
                {
                    yield return(aVertex);
                }
            }

            #endregion

            yield break;
        }
        /// <summary>
        /// Executes the query plan recursivly
        /// </summary>
        /// <param name="myVertexType">The starting vertex type</param>
        /// <returns>An enumeration of vertices</returns>
        private IEnumerable<IVertex> Execute_private(IVertexType myVertexType)
        {
            #region current type

            ISonesIndex idx = null;

            if (_expressionIndex != null)
                idx = _indexManager.GetIndex(_expressionIndex, _securityToken, _transactionToken);
            else
                idx = GetBestMatchingIdx(_indexManager.GetIndices(_property.Property, _securityToken, _transactionToken));

            foreach (var aVertex in GetValues(idx, _constant)
                                    .Select(aId => _vertexStore.GetVertex(
                                                                    _securityToken, 
                                                                    _transactionToken, 
                                                                    aId, 
                                                                    myVertexType.ID, 
                                                                    VertexEditionFilter, 
                                                                    VertexRevisionFilter)))
            {
                yield return aVertex;
            }

            #endregion

            #region child types

            foreach (var aChildVertexType in myVertexType.GetDescendantVertexTypes())
            {
                foreach (var aVertex in Execute_private(aChildVertexType))
                {
                    yield return aVertex;
                }
            }

            #endregion

            yield break;
        }
Esempio n. 3
0
        /// <summary>
        /// Removes indices
        /// </summary>
        /// <param name="myToBeRemovedIndices"></param>
        /// <param name="vertexType"></param>
        /// <param name="myTransactionToken"></param>
        /// <param name="mySecurityToken"></param>
        private void RemoveIndices(Dictionary<string, string> myToBeRemovedIndices, IVertexType vertexType, TransactionToken myTransactionToken, SecurityToken mySecurityToken)
        {
            if (myToBeRemovedIndices.IsNotNullOrEmpty())
            {
                foreach (var aIndex in myToBeRemovedIndices)
                {
                    //find the source
                    IIndexDefinition sourceIndexDefinition = vertexType.GetIndexDefinitions(false).Where(_ => _.Name == aIndex.Key && (aIndex.Value == null || _.Edition == aIndex.Value)).FirstOrDefault();

                    foreach (var aVertexType in vertexType.GetDescendantVertexTypes())
                    {
                        foreach (var aInnerIndex in aVertexType.GetIndexDefinitions(false).Where(_=>_.SourceIndex.ID == sourceIndexDefinition.ID))
                        {
                            _indexManager.RemoveIndexInstance(aInnerIndex.ID, myTransactionToken, mySecurityToken);
                        }
                    }

                    if (sourceIndexDefinition != null)
                        _indexManager.RemoveIndexInstance(sourceIndexDefinition.ID, myTransactionToken, mySecurityToken);
                }
            }
        }