本文整理汇总了C#中IVertex.HasUnstructuredProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IVertex.HasUnstructuredProperty方法的具体用法?C# IVertex.HasUnstructuredProperty怎么用?C# IVertex.HasUnstructuredProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVertex
的用法示例。
在下文中一共展示了IVertex.HasUnstructuredProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateVertexUpdateDefinition
//.........这里部分代码省略.........
#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
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: GetAllSelectedAttributesFromVertex
//.........这里部分代码省略.........
myReference,
myUsingGraph,
mySecurityToken,
myTransactionToken));
#endregion
}
else
{
Attributes.Item2.Add(alias, GetNotResolvedReferenceEdgeAttributeValue((IEnumerable<IVertex>)res.Value));
}
#endregion
}
else if (res.Value is IVertexView)
{
//the result is one or multiple 'paths'
if ((res.Value as IVertexView).HasEdge("path"))
{
var pathHyperEdge = (res.Value as IVertexView).GetAllHyperEdges().First();
if (!String.IsNullOrWhiteSpace(attrSel.Alias))
{
Attributes.Item2.Add(attrSel.Alias, pathHyperEdge.Edge);
}
else
Attributes.Item2.Add(pathHyperEdge.EdgeName, pathHyperEdge.Edge);
}
}
else
{
Attributes.Item1.Add(alias, res.Value);
}
#endregion
#endregion
}
else if (attrSel.Element is UnstructuredProperty)
{
#region undefined attribute selection
var undef_alias = attrSel.Alias;
if (!Attributes.Item1.ContainsKey(undef_alias))
{
Object attrValue = null;
if (myDBObject.HasUnstructuredProperty(undef_alias))
{
Attributes.Item1.Add(undef_alias, attrValue);
}
}
#endregion
}
else
{
#region Attribute selection
minDepth = (attrSel.RelatedIDChainDefinition != null) ? attrSel.RelatedIDChainDefinition.Edges.Count - 1 : 0;
//var alias = (attrSel.Alias == null) ? (attrSel.Element as TypeAttribute).Name : attrSel.Alias;
Depth = GetDepth(myDepth, minDepth, myDBType, attrSel.Element);
Object attrValue = null;
if (GetAttributeValueAndResolve(mySecurityToken, myTransactionToken, myDBType, attrSel, myDBObject, Depth, myLevelKey, myReference, myUsingGraph, out attrValue))
{
if (attrValue is IEdgeView)
{
Attributes.Item2.Add(alias, (IEdgeView)attrValue);
}
else
{
Attributes.Item1.Add(alias, attrValue);
}
}
#endregion
}
#endregion
}
}
return Attributes;
}