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


C# DBObjectStream.GetAttributes方法代码示例

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


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

示例1: AddAttributesByDBO

        /// <summary>
        /// This will add all attributes of <paramref name="myDBObject"/> to the <paramref name="myAttributes"/> reference. Reference attributes will be resolved to the <paramref name="myDepth"/>
        /// </summary>
        /// <param name="myAttributes"></param>
        /// <param name="myType"></param>
        /// <param name="myDBObject"></param>
        /// <param name="myDepth"></param>
        /// <param name="myEdgeList"></param>
        /// <param name="myReference"></param>
        /// <param name="myUsingGraph"></param>
        /// <param name="mySelType"></param>
        /// <param name="myTypeID"></param>
        private void AddAttributesByDBO(ref Dictionary<String, Object> myAttributes, GraphDBType myType, DBObjectStream myDBObject, Int64 myDepth, EdgeList myEdgeList, String myReference, Boolean myUsingGraph, TypesOfSelect mySelType, TypeUUID myTypeID = null)
        {

            #region Get all attributes which are stored at the DBO

            foreach (var attr in myDBObject.GetAttributes())
            {

                #region Check whether the attribute is still exist in the type - if not, continue

                var typeAttr = myType.GetTypeAttributeByUUID(attr.Key);

                if (typeAttr == null)
                {
                    continue;
                }

                #endregion

                #region Only attributes of the selected myTypeID (TypesOfSelect.Ad)

                if (mySelType == TypesOfSelect.Ad)
                {
                    if (myTypeID != typeAttr.GetDBType(_DBContext.DBTypeManager).UUID)
                    {
                        continue;
                    }
                }

                #endregion

                if (attr.Value is ADBBaseObject)
                {

                    #region Single base object

                    if (mySelType != TypesOfSelect.Minus && mySelType != TypesOfSelect.Gt && mySelType != TypesOfSelect.Lt)
                    {
                        myAttributes.Add(typeAttr.Name, (attr.Value as ADBBaseObject).GetReadoutValue());
                    }

                    #endregion

                }
                else if (attr.Value is IBaseEdge)
                {

                    #region List of base objects

                    if (mySelType != TypesOfSelect.Minus && mySelType != TypesOfSelect.Gt && mySelType != TypesOfSelect.Lt)
                    {
                        myAttributes.Add(typeAttr.Name, (attr.Value as IBaseEdge).GetReadoutValues());
                    }

                    #endregion

                }
                else if (attr.Value is IReferenceEdge)
                {

                    #region Reference edge

                    if (mySelType == TypesOfSelect.Minus || mySelType == TypesOfSelect.Asterisk || mySelType == TypesOfSelect.Ad || mySelType == TypesOfSelect.Gt)
                    {
                        // Since we can define special depth (via setting) for attributes we need to check them now
                        myDepth = GetDepth(-1, myDepth, myType, typeAttr);
                        if ((myDepth > 0))
                        {
                            myAttributes.Add(typeAttr.Name, ResolveAttributeValue(typeAttr, attr.Value, myDepth, myEdgeList, myDBObject, myReference, myUsingGraph));
                        }
                        else
                        {
                            myAttributes.Add(typeAttr.Name, GetNotResolvedReferenceAttributeValue(myDBObject, typeAttr, myType, myEdgeList, myUsingGraph, _DBContext));
                        }
                    }

                    #endregion

                }
                else
                {
                    throw new GraphDBException(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
                }

            }

            #endregion

//.........这里部分代码省略.........
开发者ID:ipbi,项目名称:sones,代码行数:101,代码来源:SelectResultManager.cs

示例2: CreateGraphDMLforDBObject

        private Exceptional<String> CreateGraphDMLforDBObject(DumpFormats myDumpFormat, DBContext myDBContext, GraphDBType myGraphDBType, DBObjectStream myDBObjectStream)
        {
            var stringBuilder = new StringBuilder();
            var delimiter = ", ";

            stringBuilder.Append(String.Concat(S_INSERT.ToUpperString(), " ", S_INTO.ToUpperString(), " ", myGraphDBType.Name, " ", S_VALUES.ToUpperString(), " ", S_BRACKET_LEFT));
            stringBuilder.Append(String.Concat(S_UUID.ToUpperString(), " = '", myDBObjectStream.ObjectUUID.ToString(), "'", delimiter));

            #region CreateGraphDMLforDBODefinedAttributes

            var defAttrsDML = CreateGraphDMLforDBObjectDefinedAttributes(myDumpFormat, myDBObjectStream.GetAttributes(), myGraphDBType, myDBObjectStream, myDBContext);

            if (!defAttrsDML.Success())
            {
                return defAttrsDML;
            }

            stringBuilder.Append(defAttrsDML.Value);

            #endregion

            #region CreateGDMLforDBOUnDefinedAttributes

            var undefAttrs = myDBObjectStream.GetUndefinedAttributes(myDBContext.DBObjectManager);

            if (!undefAttrs.Success())
            {
                return new Exceptional<String>(undefAttrs);
            }

            if (undefAttrs.Value.Count > 0)
            {

                Exceptional<String> undefAttrsDML = CreateGraphDMLforDBObjectUndefinedAttributes(myDumpFormat, undefAttrs.Value, myGraphDBType, myDBObjectStream);

                if (!undefAttrsDML.Success())
                {
                    return undefAttrsDML;
                }

                stringBuilder.Append(undefAttrsDML.Value);

            }

            #endregion

            stringBuilder.RemoveSuffix(delimiter);
            stringBuilder.Append(S_BRACKET_RIGHT);

            return new Exceptional<String>(stringBuilder.ToString());
        }
开发者ID:ipbi,项目名称:sones,代码行数:51,代码来源:GraphQueryLanguage.cs


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