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


C# IVertex.HasProperty方法代码示例

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


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

示例1: CreateVertexUpdateDefinition


//.........这里部分代码省略.........
            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
                        throw new Exception("You can not add and remove items simultaneously on a collection attribute.");
                    }

                    if (myUpdate.AddedElementsToCollectionProperties != null)
                    {
                        foreach (var added in myUpdate.AddedElementsToCollectionProperties)
                        {
                            var propDef = myVertexType.GetPropertyDefinition(added.Key);

                            var hasValue = (propDef == null)
                                ? myVertex.HasUnstructuredProperty(added.Key)
                                : myVertex.HasProperty(propDef.ID);

                            //if it is not ICollectionWrapper something wrong with deserialization
                            var extractedValue = (!hasValue)
                                ? null
                                : (propDef == null)
                                    ? myVertex.GetUnstructuredProperty<ICollectionWrapper>(added.Key)
                                    : (ICollectionWrapper)propDef.GetValue(myVertex);

                            PropertyMultiplicity mult;
                            if (propDef != null)
                            {
                                //check types only for structured properties
                                foreach (var element in added.Value)
                                {
                                    CheckPropertyType(myVertexType.Name, element, propDef);
                                }
                                mult = propDef.Multiplicity;
                            }
                            else
                                mult = (added.Value is SetCollectionWrapper)
                                    ? PropertyMultiplicity.Set
                                    : PropertyMultiplicity.List;


                            var newValue = CreateNewCollectionWrapper(
                                (hasValue)
                                    ? extractedValue.Union(added.Value)
                                    : added.Value,
                                 mult);

                            if (propDef == null)
                            {
开发者ID:anukat2015,项目名称:sones,代码行数:67,代码来源:ExecuteVertexHandler.cs

示例2: RemoveVertexFromIndices

 private void RemoveVertexFromIndices(IVertex aVertex, IVertexType myVertexType, SecurityToken mySecurityToken, Int64 myTransactionToken)
 {
     foreach (var aStructuredProperty in myVertexType.GetPropertyDefinitions(true))
     {
         if (aVertex.HasProperty(aStructuredProperty.ID))
         {
             foreach (var aIndexDefinition in aStructuredProperty.InIndices)
             {
                 RemoveFromIndices(aVertex,
                     _indexManager.GetIndices(myVertexType, aIndexDefinition.IndexedProperties, mySecurityToken, myTransactionToken));
             }
         }
     }
 }
开发者ID:anukat2015,项目名称:sones,代码行数:14,代码来源:ExecuteVertexHandler.cs

示例3: GetDefaultValue

        private static IComparable GetDefaultValue(IVertex myPropertyVertex, Type myPropertyType)
        {
            if (!myPropertyVertex.HasProperty((long)AttributeDefinitions.PropertyDotDefaultValue))
                return null;

            var val = myPropertyVertex.GetPropertyAsString((long)AttributeDefinitions.PropertyDotDefaultValue);

            return (IComparable)Convert.ChangeType(val, myPropertyType);
        }
开发者ID:loubo,项目名称:sones,代码行数:9,代码来源:BaseGraphStorageManager.cs

示例4: GetIndexTypeName

        private static String GetIndexTypeName(IVertex myIndexVertex)
        {
            if (myIndexVertex.HasProperty((long)AttributeDefinitions.IndexDotIndexClass))
                return myIndexVertex.GetPropertyAsString((long)AttributeDefinitions.IndexDotIndexClass);

            return null;
        }
开发者ID:loubo,项目名称:sones,代码行数:7,代码来源:BaseGraphStorageManager.cs

示例5: CreateIndexEntry

 /// <summary>
 /// Creates a search key by checking which properties are indexed.
 /// </summary>
 /// <param name="myIndexedProperties">Indexed properties</param>
 /// <param name="myVertex">Vertex which shall be stored in the index.</param>
 /// <returns>A search key for that index</returns>
 private static IComparable CreateIndexEntry(IList<Int64> myIndexedProperties, IVertex myVertex)
 {
     if (myIndexedProperties.Count > 1)
     {
         var values = new List<IComparable>(myIndexedProperties.Count);
         for (int i = 0; i < myIndexedProperties.Count; i++)
         {
             if (myVertex.HasProperty(myIndexedProperties[i]))
             {
                 values[i] = myVertex.GetProperty(myIndexedProperties[i]);
             }
         }
         return new ListCollectionWrapper(values);
     }
     else if (myIndexedProperties.Count == 1)
     {
         if (myVertex.HasProperty(myIndexedProperties[0]))
         {
             return myVertex.GetProperty(myIndexedProperties[0]);
         }
         return null;
     }
     throw new ArgumentException("A unique definition must contain at least one element.");
 }
开发者ID:ramz,项目名称:sones,代码行数:30,代码来源:ASonesIndex.cs

示例6: HasValue

 public static bool HasValue(this IBinaryPropertyDefinition myProperty, IVertex myVertex)
 {
     return myVertex.HasProperty(myProperty.ID);
 }
开发者ID:anukat2015,项目名称:sones,代码行数:4,代码来源:IBinaryPropertyDefintionExtension.cs

示例7: HasValue

        private static bool HasValue(this IPropertyDefinition myProperty, IVertex myVertex)
        {
            if (myProperty.RelatedType == null)
                throw new ArgumentException("A property with nor related type is not allowed.");

            if (!myProperty.RelatedType.Name.Equals(GlobalConstants.Vertex))
                return myVertex.HasProperty(myProperty.ID);

            switch (myProperty.Name)
            {
                case GlobalConstants.VertexDotComment:
                    return myVertex.Comment != null;

                case GlobalConstants.VertexDotCreationDate:
                case GlobalConstants.VertexDotEdition:
                case GlobalConstants.VertexDotModificationDate:
                case GlobalConstants.VertexDotRevision:
                case GlobalConstants.VertexDotVertexTypeID:
                case GlobalConstants.VertexDotVertexTypeName:
                case GlobalConstants.VertexDotVertexID:
                    return true;

                default:
                    throw new Exception(
                        "A new property was added to the vertex type Vertex, but this switch stement was not changed.");

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

示例8: CreateIndexEntry

 /// <summary>
 /// Creates a search key by checking which properties are indexed.
 /// </summary>
 /// <param name="myIndexedProperties">Indexed properties</param>
 /// <param name="myVertex">Vertex which shall be stored in the index.</param>
 /// <returns>A search key for that index</returns>
 private static IComparable CreateIndexEntry(Int64 myIndexedProperty, IVertex myVertex)
 {
     if (myVertex.HasProperty(myIndexedProperty))
     {
         return myVertex.GetProperty(myIndexedProperty);
     }
     return null;
 }
开发者ID:anukat2015,项目名称:sones,代码行数:14,代码来源:ASonesIndex.cs

示例9: CreateIndexEntries

 /// <summary>
 /// Creates a search key by checking which properties are indexed.
 /// </summary>
 /// <param name="myIndexedProperties">Indexed properties</param>
 /// <param name="myVertex">Vertex which shall be stored in the index.</param>
 /// <returns>A search key for that index</returns>
 private static IEnumerable<KeyValuePair<IComparable, long?>> CreateIndexEntries(IList<Int64> myIndexedProperties, IVertex myVertex)
 {
     if (myIndexedProperties.Count > 0)
     {
         var values = new List<KeyValuePair<IComparable,long?>>();
         for (int i = 0; i < myIndexedProperties.Count; i++)
         {
             if (myVertex.HasProperty(myIndexedProperties[i]))
             {
                 values.Add(new KeyValuePair<IComparable,long?>(myVertex.GetProperty(myIndexedProperties[i]), myVertex.VertexID));
             }
         }
         return values;
     }
     throw new ArgumentException("A unique definition must contain at least one element.");
 }
开发者ID:anukat2015,项目名称:sones,代码行数:22,代码来源:ASonesIndex.cs


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