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


C# GraphDBType.RemoveIndex方法代码示例

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


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

示例1: Execute

        /// <summary>
        /// Execute the removal of attribute indices
        /// <seealso cref=" AAlterTypeCommand"/>
        /// </summary>        
        public override Exceptional Execute(DBContext myDBContext, GraphDBType myGraphDBType)
        {
            var retExceptional = new Exceptional();

            foreach (var index in _IdxDropList)
            {
                var dropIdxExcept = myGraphDBType.RemoveIndex(index.Key, index.Value, myDBContext);

                if (!dropIdxExcept.Success())
                {
                    retExceptional.PushIExceptional(dropIdxExcept);
                }
            }

            return retExceptional;
        }
开发者ID:Vadi,项目名称:sones,代码行数:20,代码来源:AlterType_DropIndices.cs

示例2: Execute

        /// <summary>
        /// Executes the removal of certain myAttributes.
        /// <seealso cref=" AAlterTypeCommand"/>
        /// </summary>
        public override Exceptional Execute(DBContext myDBContext, GraphDBType myGraphDBType)
        {
            Exceptional result = new Exceptional();

            foreach (String aAttributeName in _ListOfAttributes)
            {
                var attr = myGraphDBType.GetTypeAttributeByName(aAttributeName);

                if (attr != null)
                {
                    var idxs = new List<Indices.AAttributeIndex>(myGraphDBType.GetAttributeIndices(myDBContext, attr.UUID));

                    foreach (var item in idxs)
                    {
                        var remIdxResult = myGraphDBType.RemoveIndex(item.IndexName, item.IndexEdition, myDBContext);

                        if (remIdxResult.Failed())
                        {
                            result.PushIExceptional(remIdxResult);
                        }
                    }
                }
                else
                {
                    result.PushIError(new Error_AttributeIsNotDefined(aAttributeName));
                    return result;
                }

                //Hack: remove myAttributes in DBObjects
                var aTempResult = myDBContext.DBTypeManager.RemoveAttributeFromType(myGraphDBType.Name, aAttributeName, myDBContext.DBTypeManager);

                if (aTempResult.Failed())
                {
                    result.PushIExceptional(aTempResult);
                    return result;
                }
            }

            return result;
        }
开发者ID:Vadi,项目名称:sones,代码行数:44,代码来源:AlterType_DropAttributes.cs

示例3: Execute

        public override Exceptional Execute(DBContext dbContext, GraphDBType graphDBType)
        {
            var listOfTypeAttrs = new List<TypeAttribute>();
            var retExcept = new Exceptional();

            foreach (var attr in _ListOfAttributes)
            {

                var typeAttr = graphDBType.GetTypeAttributeByName(attr);

                if (typeAttr == null)
                {
                    return new Exceptional(new Error_AttributeIsNotDefined(attr));
                }

                var attrType = dbContext.DBTypeManager.GetTypeByUUID(typeAttr.DBTypeUUID);

                if (attrType == null)
                    return new Exceptional(new Error_TypeDoesNotExist(""));

                if (attrType.IsUserDefined)
                    return new Exceptional(new Error_InvalidReferenceAssignmentOfUndefAttr());

                listOfTypeAttrs.Add(typeAttr);

            }

            var dbobjects = dbContext.DBObjectCache.SelectDBObjectsForLevelKey(new LevelKey(graphDBType, dbContext.DBTypeManager), dbContext);

            foreach (var item in dbobjects)
            {

                if (!item.Success())
                {
                    retExcept.PushIExceptional(item);
                }

                else
                {
                    foreach (var attr in listOfTypeAttrs)
                    {
                        if (item.Value.HasAttribute(attr.UUID, graphDBType))
                        {
                            var attrVal = item.Value.GetAttribute(attr.UUID);

                            var addExcept = item.Value.AddUndefinedAttribute(attr.Name, attrVal, dbContext.DBObjectManager);

                            if (!addExcept.Success())
                                retExcept.PushIExceptional(addExcept);

                            item.Value.RemoveAttribute(attr.UUID);

                            var saveExcept = dbContext.DBObjectManager.FlushDBObject(item.Value);

                            if (!saveExcept.Success())
                                retExcept.PushIExceptional(saveExcept);
                        }
                    }
                }
            }

            var indices = graphDBType.GetAllAttributeIndices();
            List<AAttributeIndex> idxToDelete = new List<AAttributeIndex>();

            //remove attributes from type
            foreach (var attr in listOfTypeAttrs)
            {

                foreach (var item in indices)
                {
                    var index = item.IndexKeyDefinition.IndexKeyAttributeUUIDs.Find(idx => idx == attr.UUID);

                    if (index != null && item.IndexKeyDefinition.IndexKeyAttributeUUIDs.Count == 1)
                    {
                        idxToDelete.Add(item);
                    }
                }

                //remove indices
                foreach (var idx in idxToDelete)
                {
                    var remExcept = graphDBType.RemoveIndex(idx.IndexName, idx.IndexEdition, dbContext.DBTypeManager);

                    if (!remExcept.Success())
                    {
                        retExcept.PushIExceptional(remExcept);
                    }
                }

                idxToDelete.Clear();
                graphDBType.RemoveAttribute(attr.UUID);

                var flushExcept = dbContext.DBTypeManager.FlushType(graphDBType);

                if (!flushExcept.Success())
                {
                    retExcept.PushIExceptional(flushExcept);
                }
            }

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


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