当前位置: 首页>>代码示例>>C#>>正文


C# IVertexType.GetIndexDefinitions方法代码示例

本文整理汇总了C#中IVertexType.GetIndexDefinitions方法的典型用法代码示例。如果您正苦于以下问题:C# IVertexType.GetIndexDefinitions方法的具体用法?C# IVertexType.GetIndexDefinitions怎么用?C# IVertexType.GetIndexDefinitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVertexType的用法示例。


在下文中一共展示了IVertexType.GetIndexDefinitions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetIndices

 public IEnumerable<ISonesIndex> GetIndices(IVertexType myVertexType, IPropertyDefinition myPropertyDefinition, SecurityToken mySecurityToken, Int64 myTransactionToken)
 {
     myVertexType.CheckNull("myVertexType");
     return myVertexType.GetIndexDefinitions(false).Where(_=>_.IndexedProperties.Count == 1 && _.IndexedProperties.Contains(myPropertyDefinition)).Select(_ => _indices[_.ID]);
     //return myPropertyDefinition.InIndices.Where(_ => myVertexType.Equals(_.VertexType)).Select(_ => _indices[_.ID]);
 }
开发者ID:cosh,项目名称:sones,代码行数:6,代码来源:IndexManager.cs

示例2: RebuildIndices

        private void RebuildIndices(IVertexType myVertexType, Int64 myTransaction, SecurityToken mySecurity, bool myOnlyNonPersistent )
        {
            Dictionary<IList<IPropertyDefinition>, IEnumerable<ISonesIndex>> toRebuild = new Dictionary<IList<IPropertyDefinition>, IEnumerable<ISonesIndex>>();
            foreach (var indexDef in myVertexType.GetIndexDefinitions(false))
            {
                var indices = GetIndices(myVertexType, indexDef.IndexedProperties, mySecurity, myTransaction).Where(_=>!myOnlyNonPersistent || !GetIsPersistentIndex(_));
                toRebuild.Add(indexDef.IndexedProperties, indices);
            }

            if (toRebuild.Count > 0)
            {
                foreach (var aIdxCollection in toRebuild.Values)
                {
                    foreach (var aIdx in aIdxCollection)
                    {
                        aIdx.Clear();
                    }
                }

                var vertices = _vertexStore.GetVerticesByTypeID(mySecurity, myTransaction, myVertexType.ID);

                foreach (var vertex in vertices)
                {
                    foreach (var indexGroup in toRebuild)
                    {
                        foreach (var index in indexGroup.Value)
                        {
                            index.Add(CreateIndexKey(indexGroup.Key, vertex), vertex.VertexID);
                        }
                    }
                }
            }
        }
开发者ID:cosh,项目名称:sones,代码行数:33,代码来源:IndexManager.cs

示例3: CreateGraphDDL_VertexType


//.........这里部分代码省略.........

                    if (myVertexType.GetAttributeDefinitions(false).Any(aAttribute => aAttribute.Kind == AttributeType.Property))
                    {
                        stringBuilder.Append(String.Concat(CreateGraphDDLOfProperties(myVertexType.GetPropertyDefinitions(false))));
                    }

                    #endregion

                    #region outgoing edges

                    if (myVertexType.GetAttributeDefinitions(false).Any(aAttribute => aAttribute.Kind == AttributeType.OutgoingEdge))
                    {
                        stringBuilder.Append(String.Concat(CreateGraphDDLOfOutgoingEdges(myVertexType.GetOutgoingEdgeDefinitions(false), myVertexType)));
                    }

                    #endregion

                    if (stringBuilder.ToString().EndsWith(delimiter))
                        stringBuilder.RemoveSuffix(delimiter);

                    stringBuilder.Append(String.Concat(S_BRACKET_RIGHT, " "));

                }

                #endregion

                #region incomingEdges

                if (myVertexType.GetAttributeDefinitions(false).Any(aAttribute => aAttribute.Kind == AttributeType.IncomingEdge))
                {
                    stringBuilder.Append(
                        String.Concat(S_INCOMINGEDGES.ToUpperString(),
                                        " ",
                                        S_BRACKET_LEFT.ToUpperString(),
                                        CreateGraphDDLOfIncomingEdges(
                                            myVertexType.GetIncomingEdgeDefinitions(false)),
                                        S_BRACKET_RIGHT.ToUpperString(), " "));
                }

                #endregion
            }

            #endregion

            #region Uniques

            if (myVertexType.HasUniqueDefinitions(false))
            {
                if (myVertexType.GetUniqueDefinitions(false).Count() > 0)
                {
                    stringBuilder.Append(S_UNIQUE.ToUpperString() +
                                            " " +
                                            S_BRACKET_LEFT.Symbol +
                                            CreateGraphDDLOfUniqueAttributes(
                                                myVertexType
                                                    .GetUniqueDefinitions(false)) +
                                            S_BRACKET_RIGHT.Symbol + " ");
                }
            }

            #endregion

            #region Mandatory attributes

            if (myVertexType.HasProperties(false))
            {
                if (myVertexType.GetPropertyDefinitions(false).Any(aProperty => aProperty.IsMandatory))
                {
                    stringBuilder.Append(S_MANDATORY.ToUpperString() +
                                            " " +
                                            S_BRACKET_LEFT.Symbol +
                                            CreateGraphDDLOfMandatoryAttributes(
                                                myVertexType
                                                    .GetPropertyDefinitions(false)
                                                    .Where(aProperty => aProperty.IsMandatory)) +
                                            S_BRACKET_RIGHT.Symbol + " ");
                }
            }

            #endregion

            #region Indices

            var indices =
                myVertexType.GetIndexDefinitions(false).Except(
                    myVertexType.GetUniqueDefinitions(false).Select(_ => _.CorrespondingIndex));

            if (indices.Count() > 0)
            {
                stringBuilder.Append(S_INDICES.ToUpperString() +
                                        " " +
                                        S_BRACKET_LEFT.Symbol +
                                        CreateGraphDDLOfIndices(indices, myVertexType) +
                                        S_BRACKET_RIGHT.Symbol);
            }

            #endregion

            return stringBuilder.ToString();
        }
开发者ID:cosh,项目名称:sones,代码行数:101,代码来源:SonesGQLGrammar.cs

示例4: GenerateIndicesOutput

        /// <summary>
        /// output for the type indices
        /// </summary>
        /// <param name="myType">The db type</param>
        /// <param name="myDBContext">The db context</param>
        /// <returns>a list of readouts, contains the attributes</returns>
        private IEnumerable<ISingleEdgeView> GenerateIndicesOutput(IVertexType myType)
        {
            var _AttributeReadout = new List<ISingleEdgeView>();

            foreach (var idx in myType.GetIndexDefinitions(true))
            {

                var Attributes = new Dictionary<String, Object>();

                Attributes.Add("ID", idx.ID);
                Attributes.Add("Type", idx.IndexTypeName);
                Attributes.Add("Name", idx.Name);
                Attributes.Add("Edition", idx.Edition);

                var list = new ListCollectionWrapper();
                foreach (var item in idx.IndexedProperties)
                    list.Add(item.Name);

                Attributes.Add("IndexedProperties", list);

                _AttributeReadout.Add(new SingleEdgeView(null, new VertexView(Attributes, new Dictionary<String, IEdgeView>())));

            }

            return _AttributeReadout;
        }
开发者ID:loubo,项目名称:sones,代码行数:32,代码来源:DescribeTypeDefinition.cs

示例5: RemoveIndices

        /// <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);
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:29,代码来源:ExecuteVertexTypeManager.cs

示例6: RebuildIndices

        private void RebuildIndices(IVertexType myVertexType, TransactionToken myTransaction, SecurityToken mySecurity, bool myOnlyNonPersistent )
        {
            Dictionary<IList<IPropertyDefinition>, IEnumerable<IIndex<IComparable, Int64>>> toRebuild = new Dictionary<IList<IPropertyDefinition>, IEnumerable<IIndex<IComparable, long>>>();
            foreach (var indexDef in myVertexType.GetIndexDefinitions(false))
            {
                var indices = GetIndices(myVertexType, indexDef.IndexedProperties, mySecurity, myTransaction).Where(_=>!myOnlyNonPersistent || !_.IsPersistent);
                toRebuild.Add(indexDef.IndexedProperties, indices);
            }

            if (toRebuild.Count > 0)
            {
                foreach (var aIdxCollection in toRebuild.Values)
                {
                    foreach (var aIdx in aIdxCollection)
                    {
                        aIdx.ClearIndex();
                    }
                }

                var vertices = _vertexStore.GetVerticesByTypeID(mySecurity, myTransaction, myVertexType.ID);

                foreach (var vertex in vertices)
                {
                    foreach (var indexGroup in toRebuild)
                    {
                        foreach (var index in indexGroup.Value)
                        {
                            var key = CreateIndexKey(indexGroup.Key, vertex);
                            if (key != null)
                            {
                                if (index is ISingleValueIndex<IComparable, Int64>)
                                {
                                    (index as ISingleValueIndex<IComparable, Int64>).Add(key, vertex.VertexID);
                                }
                                else if (index is IMultipleValueIndex<IComparable, Int64>)
                                {
                                    //Perf: We do not need to add a set of values. Initializing a HashSet is to expensive for this operation.
                                    //TODO: Refactor IIndex structure
                                    (index as IMultipleValueIndex<IComparable, Int64>).Add(key, new HashSet<Int64> { vertex.VertexID });
                                }
                                else
                                {
                                    throw new NotImplementedException(
                                        "Indices other than single or multiple value indices are not supported yet.");
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:51,代码来源:IndexManager.cs

示例7: CheckToBeRemovedIndices

        /// <summary>
        /// Checks if the desired index are removable
        /// </summary>
        /// <param name="myToBeRemovedIndices"></param>
        /// <param name="vertexType"></param>
        private static void CheckToBeRemovedIndices(Dictionary<string, string> myToBeRemovedIndices, IVertexType vertexType)
        {
            if (myToBeRemovedIndices == null)
                return;

            var indexDefinitions = vertexType.GetIndexDefinitions(true).ToList();

            foreach (var aKV in myToBeRemovedIndices)
            {
                if (!indexDefinitions.Any(_ => _.Name == aKV.Key && (aKV.Value == null || _.Edition == aKV.Value)))
                {
                    throw new IndexRemoveException(aKV.Key, aKV.Value, "The desired index does not exist.");
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:20,代码来源:CheckVertexTypeManager.cs

示例8: CheckToBeAddedIndices

        /// <summary>
        /// Checks if every to be added index is valid
        /// </summary>
        /// <param name="myToBeAddedIndices"></param>
        /// <param name="vertexType"></param>
        private static void CheckToBeAddedIndices(IEnumerable<IndexPredefinition> myToBeAddedIndices, IVertexType vertexType)
        {
            if (myToBeAddedIndices == null)
                return;

            var indexDefinitions = vertexType.GetIndexDefinitions(true).ToList();

            foreach (var aIndexPredefinition in myToBeAddedIndices)
            {
                #region check the properties

                foreach (var aProperty in aIndexPredefinition.Properties)
                {
                    if (!vertexType.HasProperty(aProperty))
                    {
                        throw new AttributeDoesNotExistException(aProperty, vertexType.Name);
                    }
                }

                #endregion

                #region check the idx name, etc

                if (indexDefinitions.Any(_ => _.Name == aIndexPredefinition.Name))
                {
                    throw new IndexCreationException(aIndexPredefinition, "This index definition is ambiguous.");
                }

                #endregion
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:36,代码来源:CheckVertexTypeManager.cs


注:本文中的IVertexType.GetIndexDefinitions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。