本文整理汇总了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)
{
示例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));
}
}
}
}
示例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);
}
示例4: GetIndexTypeName
private static String GetIndexTypeName(IVertex myIndexVertex)
{
if (myIndexVertex.HasProperty((long)AttributeDefinitions.IndexDotIndexClass))
return myIndexVertex.GetPropertyAsString((long)AttributeDefinitions.IndexDotIndexClass);
return null;
}
示例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.");
}
示例6: HasValue
public static bool HasValue(this IBinaryPropertyDefinition myProperty, IVertex myVertex)
{
return myVertex.HasProperty(myProperty.ID);
}
示例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.");
}
}
示例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;
}
示例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.");
}