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


C# DBObjectStream.RemoveAttribute方法代码示例

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


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

示例1: ApplyRemoveAttribute

        /// <summary>
        /// Execute the remove of attributes
        /// </summary>
        /// <param name="myAttrsToRemove">The list of attributes to remove</param>
        /// <param name="myDBContext">The db context</param>
        /// <param name="myDBDBObject">The db object from which the attributes should be deleted</param>
        /// <param name="myGraphDBType">The type of the db object</param>
        /// <returns>The list of removed attributes</returns>
        private Exceptional<List<TypeAttribute>> ApplyRemoveAttribute(List<string> myAttrsToRemove, DBContext myDBContext, DBObjectStream myDBDBObject, GraphDBType myGraphDBType)
        {
            #region data

            List<TypeAttribute> removedAttributes = new List<TypeAttribute>();

            #endregion

            var MandatoryTypeAttrib = myGraphDBType.GetMandatoryAttributesUUIDs(myDBContext.DBTypeManager);
            foreach (String aAttribute in myAttrsToRemove)
            {
                TypeAttribute typeAttribute = myGraphDBType.GetTypeAttributeByName(aAttribute);

                if (myDBDBObject.HasAttribute(typeAttribute.UUID, myGraphDBType))
                {
                    if (!MandatoryTypeAttrib.Contains(typeAttribute.UUID))
                    {
                        #region remove backward edges

                        if (typeAttribute.GetDBType(myDBContext.DBTypeManager).IsUserDefined)
                        {
                            var userdefinedAttributes = new Dictionary<AttributeUUID, object>();
                            userdefinedAttributes.Add(typeAttribute.UUID, myDBDBObject.GetAttribute(typeAttribute.UUID));

                            RemoveBackwardEdges(myGraphDBType.UUID, userdefinedAttributes, myDBDBObject.ObjectUUID, myDBContext);
                        }

                        #endregion

                        myDBDBObject.RemoveAttribute(typeAttribute.UUID);
                        removedAttributes.Add(typeAttribute);
                    }
                    else
                    {
                        return new Exceptional<List<TypeAttribute>>(new Error_MandatoryConstraintViolation("Error in update statement. The attribute \"" + typeAttribute.Name + "\" is mandatory and can not be removed."));
                    }
                }
            }

            return new Exceptional<List<TypeAttribute>>(removedAttributes);
        }
开发者ID:Vadi,项目名称:sones,代码行数:49,代码来源:AttributeRemove.cs


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