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


C# IVertex.HasUnstructuredProperty方法代码示例

本文整理汇总了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)
开发者ID:anukat2015,项目名称:sones,代码行数:67,代码来源:ExecuteVertexHandler.cs

示例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;
        }
开发者ID:cosh,项目名称:sones,代码行数:101,代码来源:SelectResultManager.cs


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