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


C# IVertexType.GetDescendantVertexTypesAndSelf方法代码示例

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


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

示例1: ProcessDropIndex

 private void ProcessDropIndex(IEnumerable<IIndexDefinition> myToBeDroppedIndices, IVertexType vertexType, SecurityToken mySecurityToken, Int64 myTransactionToken)
 {
     foreach (var aVertexType in vertexType.GetDescendantVertexTypesAndSelf())
     {
         foreach (var aIndexDefinition in myToBeDroppedIndices)
         {
             RemoveIndexInstance(aIndexDefinition.ID, myTransactionToken, mySecurityToken);
         }
     }
 }
开发者ID:cosh,项目名称:sones,代码行数:10,代码来源:IndexManager.cs

示例2: GetVertices

        public override IEnumerable<IVertex> GetVertices(IVertexType myVertexType, Int64 myTransaction, SecurityToken mySecurity, Boolean includeSubtypes)
        {
            if (includeSubtypes)
            {
                return myVertexType.GetDescendantVertexTypesAndSelf().SelectMany(_ => _vertexStore.GetVerticesByTypeID(mySecurity, myTransaction, _.ID));
            }
            else
            {
                return _vertexStore.GetVerticesByTypeID(mySecurity, myTransaction, myVertexType.ID);
            }

        }
开发者ID:anukat2015,项目名称:sones,代码行数:12,代码来源:ExecuteVertexHandler.cs

示例3: CheckTargetVertices

 private static void CheckTargetVertices(IVertexType myTargetVertexType, IEnumerable<VertexInformation> vertexIDs)
 {
     var distinctTypeIDS = new HashSet<Int64>(vertexIDs.Select(x => x.VertexTypeID));
     var allowedTypeIDs = new HashSet<Int64>(myTargetVertexType.GetDescendantVertexTypesAndSelf().Select(x => x.ID));
     distinctTypeIDS.ExceptWith(allowedTypeIDs);
     if (distinctTypeIDS.Count > 0)
         throw new Exception("A target vertex has a type, that is not assignable to the target vertex type of the edge.");
 }
开发者ID:anukat2015,项目名称:sones,代码行数:8,代码来源:ExecuteVertexHandler.cs

示例4: AddMandatoryConstraint

        /// <summary>
        /// Adds a mandatory constraint
        /// </summary>
        /// <param name="myToBeAddedMandatories"></param>
        /// <param name="vertexType"></param>
        /// <param name="myTransactionToken"></param>
        /// <param name="mySecurityToken"></param>
        private void AddMandatoryConstraint(IEnumerable<MandatoryPredefinition> myToBeAddedMandatories, IVertexType vertexType, TransactionToken myTransactionToken, SecurityToken mySecurityToken)
        {
            if (myToBeAddedMandatories.IsNotNullOrEmpty())
            {
                foreach (var aMandatory in myToBeAddedMandatories)
                {
                    var property = vertexType.GetPropertyDefinition(aMandatory.MandatoryAttribute);
                    var defaultValue = property.DefaultValue;

                    //get new mandatory value and set it
                    if (aMandatory.DefaultValue != null)
                    {
                        var defaultValueUpdate = new VertexUpdateDefinition(null, new StructuredPropertiesUpdate(new Dictionary<long, IComparable> { { (long)AttributeDefinitions.PropertyDotDefaultValue, aMandatory.DefaultValue.ToString() } }));
                        _vertexManager.ExecuteManager.VertexStore.UpdateVertex(mySecurityToken, myTransactionToken, property.ID, (long)BaseTypes.Property, defaultValueUpdate);

                        defaultValue = aMandatory.DefaultValue.ToString();
                    }

                    var vertexDefaultValueUpdate = new VertexUpdateDefinition(null, new StructuredPropertiesUpdate(new Dictionary<long, IComparable> { { property.ID, defaultValue } }));

                    foreach (var aVertexType in vertexType.GetDescendantVertexTypesAndSelf())
                    {
                        foreach (var aVertexWithoutPropery in _vertexManager.ExecuteManager.VertexStore.GetVerticesByTypeID(mySecurityToken, myTransactionToken, vertexType.ID).Where(_ => !_.HasProperty(property.ID)).ToList())
                        {
                            if (defaultValue != null)
                            {
                                //update
                                _vertexManager.ExecuteManager.VertexStore.UpdateVertex(mySecurityToken, myTransactionToken, aVertexWithoutPropery.VertexID, aVertexWithoutPropery.VertexTypeID, vertexDefaultValueUpdate);
                            }
                            else
                            {
                                throw new MandatoryConstraintViolationException(aMandatory.MandatoryAttribute);
                            }
                        }
                    }
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:45,代码来源:ExecuteVertexTypeManager.cs

示例5: RemoveUniqueConstraint

        /// <summary>
        /// Removes unique constaints
        /// </summary>
        /// <param name="myUniqueConstraints"></param>
        /// <param name="myVertexType"></param>
        /// <param name="myTransactionToken"></param>
        /// <param name="mySecurityToken"></param>
        private void RemoveUniqueConstraint(IEnumerable<string> myUniqueConstraints, IVertexType myVertexType, TransactionToken myTransactionToken, SecurityToken mySecurityToken)
        {
            if (myUniqueConstraints.IsNotNullOrEmpty())
            {
                foreach (var aUniqueConstraint in myUniqueConstraints)
                {
                    foreach (var item in myVertexType.GetDescendantVertexTypesAndSelf())
                    {
                        foreach (var aUniqueDefinition in item.GetUniqueDefinitions(false))
                        {
                            if (aUniqueDefinition.CorrespondingIndex.IndexedProperties.All(_ => _.Name == aUniqueConstraint))
                            {
                                _indexManager.RemoveIndexInstance(aUniqueDefinition.CorrespondingIndex.ID, myTransactionToken, mySecurityToken);
                            }
                        }

                    }
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:27,代码来源:ExecuteVertexTypeManager.cs

示例6: CheckToBeAddedAttributes

        /// <summary>
        /// Checks if the to be added attributes exist in the given vertex type or derived oness
        /// </summary>
        /// <param name="myAlterVertexTypeRequest"></param>
        /// <param name="vertexType"></param>
        private static void CheckToBeAddedAttributes(RequestAlterVertexType myAlterVertexTypeRequest, IVertexType vertexType)
        {
            foreach (var aVertexType in vertexType.GetDescendantVertexTypesAndSelf())
            {
                var attributesOfCurrentVertexType = aVertexType.GetAttributeDefinitions(false).ToList();

                #region binary properties
                if (myAlterVertexTypeRequest.ToBeAddedBinaryProperties != null)
                {
                    foreach (var aToBeAddedAttribute in myAlterVertexTypeRequest.ToBeAddedBinaryProperties)
                    {
                        if (attributesOfCurrentVertexType.Any(_ => _.Name == aToBeAddedAttribute.AttributeName))
                        {
                            throw new VertexAttributeAlreadyExistsException(aToBeAddedAttribute.AttributeName);
                        }
                    }
                }

                #endregion

                #region outgoing edges

                if (myAlterVertexTypeRequest.ToBeAddedOutgoingEdges != null)
                {
                    foreach (var aToBeAddedAttribute in myAlterVertexTypeRequest.ToBeAddedOutgoingEdges)
                    {
                        if (attributesOfCurrentVertexType.Any(_ => _.Name == aToBeAddedAttribute.AttributeName))
                        {
                            throw new VertexAttributeAlreadyExistsException(aToBeAddedAttribute.AttributeName);
                        }
                    }
                }

                #endregion

                #region Incoming edges
                if (myAlterVertexTypeRequest.ToBeAddedIncomingEdges != null)
                {
                    foreach (var aToBeAddedAttribute in myAlterVertexTypeRequest.ToBeAddedIncomingEdges)
                    {
                        if (attributesOfCurrentVertexType.Any(_ => _.Name == aToBeAddedAttribute.AttributeName))
                        {
                            throw new VertexAttributeAlreadyExistsException(aToBeAddedAttribute.AttributeName);
                        }
                    }
                }

                #endregion

                #region property

                if (myAlterVertexTypeRequest.ToBeAddedProperties != null)
                {
                    foreach (var aToBeAddedAttribute in myAlterVertexTypeRequest.ToBeAddedProperties)
                    {
                        if (attributesOfCurrentVertexType.Any(_ => _.Name == aToBeAddedAttribute.AttributeName))
                        {
                            throw new VertexAttributeAlreadyExistsException(aToBeAddedAttribute.AttributeName);
                        }
                    }
                }

                #endregion

                #region unknown attributes

                if (myAlterVertexTypeRequest.ToBeAddedUnknownAttributes != null)
                {
                    foreach (var aToBeAddedAttribute in myAlterVertexTypeRequest.ToBeAddedUnknownAttributes)
                    {
                        if (attributesOfCurrentVertexType.Any(_ => _.Name == aToBeAddedAttribute.AttributeName))
                        {
                            throw new VertexAttributeAlreadyExistsException(aToBeAddedAttribute.AttributeName);
                        }
                    }
                }

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


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