本文整理汇总了C#中sones.GraphDB.TypeManagement.GraphDBType.GetAllAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# GraphDBType.GetAllAttributes方法的具体用法?C# GraphDBType.GetAllAttributes怎么用?C# GraphDBType.GetAllAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sones.GraphDB.TypeManagement.GraphDBType
的用法示例。
在下文中一共展示了GraphDBType.GetAllAttributes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTypeAndAttributesRecursivly
private void AddTypeAndAttributesRecursivly(DBContext myDBContext, GraphDBType type, ref HashSet<GraphDBType> types)
{
if (!type.IsUserDefined) return;
foreach (var ptype in myDBContext.DBTypeManager.GetAllParentTypes(type, true, false))
{
if (!types.Contains(ptype))
{
types.Add(ptype);
foreach (var attr in type.GetAllAttributes(ta => !ta.IsBackwardEdge, myDBContext, false))
{
AddTypeAndAttributesRecursivly(myDBContext, attr.GetDBType(myDBContext.DBTypeManager), ref types);
}
}
//types.UnionWith(myDBContext.DBTypeManager.GetAllParentTypes(type, true, false));
}
}
示例2: GetSpecialAttributes
private IEnumerable<TypeAttribute> GetSpecialAttributes(GraphDBType type)
{
if (!_SpecialAttributesByType.ContainsKey(type))
{
_SpecialAttributesByType.Add(type, type.GetAllAttributes(t => t is ASpecialTypeAttribute, _DBContext).ToList());
}
return _SpecialAttributesByType[type];
}
示例3: Execute
public override Exceptional Execute(DBContext dbContext, GraphDBType graphDBType)
{
var listOfTypeAttributes = new Dictionary<TypeAttribute, GraphDBType>();
var retExcept = new Exceptional();
var existingTypeAttributes = graphDBType.GetAllAttributes(dbContext);
foreach (var attr in _ListOfAttributes)
{
var createExcept = attr.CreateTypeAttribute(dbContext);
if (!createExcept.Success())
{
retExcept.PushIExceptional(createExcept);
}
if (existingTypeAttributes.Exists(item => item.Name == createExcept.Value.Name))
{
retExcept.PushIExceptional(new Exceptional(new Error_AttributeAlreadyExists(createExcept.Value.Name)));
}
var attrType = dbContext.DBTypeManager.GetTypeByName(attr.AttributeType.Name);
if (attrType == null)
{
retExcept.PushIExceptional(new Exceptional(new Error_TypeDoesNotExist(attr.AttributeType.Name)));
return retExcept;
}
if (attrType.IsUserDefined)
{
retExcept.PushIExceptional(new Exceptional(new Error_InvalidReferenceAssignmentOfUndefAttr()));
return retExcept;
}
createExcept.Value.DBTypeUUID = attrType.UUID;
createExcept.Value.RelatedGraphDBTypeUUID = graphDBType.UUID;
graphDBType.AddAttribute(createExcept.Value, dbContext.DBTypeManager, true);
var flushExcept = dbContext.DBTypeManager.FlushType(graphDBType);
if (!flushExcept.Success())
{
retExcept.PushIExceptional(flushExcept);
}
listOfTypeAttributes.Add(createExcept.Value, attrType);
}
var dbobjects = dbContext.DBObjectCache.SelectDBObjectsForLevelKey(new LevelKey(graphDBType, dbContext.DBTypeManager), dbContext);
foreach (var item in dbobjects)
{
if (!item.Success())
{
retExcept.PushIExceptional(item);
}
else
{
var undefAttrExcept = item.Value.GetUndefinedAttributePayload(dbContext.DBObjectManager);
if (!undefAttrExcept.Success())
{
retExcept.PushIExceptional(undefAttrExcept);
}
foreach (var attr in listOfTypeAttributes)
{
IObject value;
if (undefAttrExcept.Value.TryGetValue(attr.Key.Name, out value))
{
var typeOfOperator = GraphDBTypeMapper.ConvertGraph2CSharp(attr.Value.Name);
if (GraphDBTypeMapper.IsAValidAttributeType(attr.Value, typeOfOperator, dbContext, value))
{
item.Value.AddAttribute(attr.Key.UUID, value);
var removeExcept = item.Value.RemoveUndefinedAttribute(attr.Key.Name, dbContext.DBObjectManager);
if (!removeExcept.Success())
{
retExcept.PushIExceptional(removeExcept);
}
var flushExcept = dbContext.DBObjectManager.FlushDBObject(item.Value);
if (!flushExcept.Success())
{
retExcept.PushIExceptional(flushExcept);
}
}
else
{
retExcept.PushIExceptional(new Exceptional(new Error_InvalidUndefAttrType(attr.Key.Name, attr.Value.Name)));
}
}
}
}
}
//.........这里部分代码省略.........
示例4: GetBackwardEdgeAttributes
private IEnumerable<TypeAttribute> GetBackwardEdgeAttributes(GraphDBType type)
{
if (!_BackwardEdgeAttributesByType.ContainsKey(type))
{
_BackwardEdgeAttributesByType.Add(type, type.GetAllAttributes(t => t.IsBackwardEdge, _DBContext).ToList());
}
return _BackwardEdgeAttributesByType[type];
}