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


C# IVertexType.GetPropertyDefinition方法代码示例

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


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

示例1: CheckAddStructuredProperties

        protected static void CheckAddStructuredProperties(IDictionary<String, IComparable> myProperties, IVertexType vertexType)
        {
            foreach (var prop in myProperties)
            {
                var propertyDef = vertexType.GetPropertyDefinition(prop.Key);
                if (propertyDef == null)
                    throw new AttributeDoesNotExistException(prop.Key, vertexType.Name);

                if (propertyDef.Multiplicity == PropertyMultiplicity.Single)
                {
                    CheckPropertyType(vertexType.Name, prop.Value, propertyDef);
                }
                else
                {
                    IEnumerable<IComparable> items = prop.Value as IEnumerable<IComparable>;
                    if (items == null)
                    {
                        throw new PropertyHasWrongTypeException(vertexType.Name, prop.Key, propertyDef.Multiplicity, propertyDef.BaseType.Name);
                    }

                    foreach (var item in items)
                    {
                        CheckPropertyType(vertexType.Name, item, propertyDef);
                    }
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:27,代码来源:AVertexHandler.cs

示例2: CreateVertexUpdateDefinition


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

                foreach (var name in myUpdate.RemovedUnstructuredProperties)
                {
                    if ((myVertexType.HasAttribute(name)) && (myVertexType.GetAttributeDefinition(name).Kind == AttributeType.Property))
                    {
                        toBeDeletedUnstructured = toBeDeletedUnstructured ?? new List<String>();
                        toBeDeletedUnstructured.Add(name);
                    }
                }

                #endregion
            }

            #endregion

            #region get update definitions

            IDictionary<Int64, HyperEdgeUpdateDefinition> toBeUpdatedHyper = null;
            IDictionary<Int64, SingleEdgeUpdateDefinition> toBeUpdatedSingle = null;
            IDictionary<Int64, IComparable> toBeUpdatedStructured = null;
            IDictionary<String, Object> toBeUpdatedUnstructured = null;
            IDictionary<Int64, StreamAddDefinition> toBeUpdatedBinaries = null;
            long? revision = null;
            string edition = myUpdate.UpdatedEdition;
            string comment = myUpdate.UpdatedComment;

            #region property copy things

            if (myPropertyCopy.StructuredProperties != null)
            {
                toBeUpdatedStructured = new Dictionary<long, IComparable>();
                foreach (var prop in myPropertyCopy.StructuredProperties)
                {
                    var propDef = myVertexType.GetPropertyDefinition(prop.Key);
                    CheckPropertyType(myVertexType.Name, prop.Value, propDef);
                    toBeUpdatedStructured.Add(propDef.ID, prop.Value);
                }
            }

            toBeUpdatedUnstructured = myPropertyCopy.UnstructuredProperties;

            #endregion

            #region binary properties
            if (myUpdate.UpdatedBinaryProperties != null)
            {
                foreach (var prop in myUpdate.UpdatedBinaryProperties)
                {
                    var propDef = myVertexType.GetBinaryPropertyDefinition(prop.Key);

                    toBeUpdatedBinaries = toBeUpdatedBinaries ?? new Dictionary<long, StreamAddDefinition>();
                    toBeUpdatedBinaries.Add(propDef.ID, new StreamAddDefinition(propDef.ID, prop.Value));
                }
            }
            #endregion

            #region collections

            if (myUpdate.AddedElementsToCollectionProperties != null || myUpdate.RemovedElementsFromCollectionProperties != null)
            {
                if (myUpdate.AddedElementsToCollectionProperties != null && myUpdate.RemovedElementsFromCollectionProperties != null)
                {
                    var keys = myUpdate.AddedElementsToCollectionProperties.Keys.Intersect(myUpdate.RemovedElementsFromCollectionProperties.Keys);
                    if (keys.CountIsGreater(0))
                    {
                        //TOTO a better exception here
开发者ID:anukat2015,项目名称:sones,代码行数:67,代码来源:ExecuteVertexHandler.cs

示例3: GetStructuredFromVertex

        private IDictionary<String, IComparable> GetStructuredFromVertex(IVertex vertex, IVertexType vertexType, IEnumerable<string> neededPropNames)
        {
            var result = new Dictionary<String, IComparable>();
            foreach (var propName in neededPropNames)
            {
                var propDef = vertexType.GetPropertyDefinition(propName);

                if (propDef.HasValue(vertex))
                    result.Add(propName, propDef.GetValue(vertex));
            }

            return result;
        }
开发者ID:loubo,项目名称:sones,代码行数:13,代码来源: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: RemoveMandatoryConstraint

        /// <summary>
        /// Removes mandatory constraits
        /// </summary>
        /// <param name="myToBeRemovedMandatories"></param>
        /// <param name="myVertexType"></param>
        /// <param name="myTransactionToken"></param>
        /// <param name="mySecurityToken"></param>
        private void RemoveMandatoryConstraint(IEnumerable<string> myToBeRemovedMandatories, IVertexType myVertexType, TransactionToken myTransactionToken, SecurityToken mySecurityToken)
        {
            if (myToBeRemovedMandatories.IsNotNullOrEmpty())
            {
                var update = new VertexUpdateDefinition(null, new StructuredPropertiesUpdate(new Dictionary<long, IComparable> { { (long)AttributeDefinitions.PropertyDotIsMandatory, false } }));

                foreach (var aMandatory in myToBeRemovedMandatories)
                {
                    IPropertyDefinition property = myVertexType.GetPropertyDefinition(aMandatory);

                    _vertexManager.ExecuteManager.VertexStore.UpdateVertex(mySecurityToken, myTransactionToken, property.ID, (long)BaseTypes.Property, null);
                }
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:21,代码来源:ExecuteVertexTypeManager.cs

示例6: ProcessPropertyRemoval

        private void ProcessPropertyRemoval(IEnumerable<string> myToBeRemovedProperties, IVertexType vertexType, TransactionToken myTransactionToken, SecurityToken mySecurityToken)
        {
            foreach (var aProperty in myToBeRemovedProperties)
            {
                #region remove related indices

                var propertyDefinition = vertexType.GetPropertyDefinition(aProperty);

                foreach (var aIndexDefinition in propertyDefinition.InIndices)
                {
                    _indexManager.RemoveIndexInstance(aIndexDefinition.ID, myTransactionToken, mySecurityToken);
                }

                #endregion

                _vertexManager.ExecuteManager.VertexStore.RemoveVertex(mySecurityToken, myTransactionToken, propertyDefinition.ID, (long)BaseTypes.Property);
            }
        }
开发者ID:loubo,项目名称:sones,代码行数:18,代码来源:ExecuteVertexTypeManager.cs


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