本文整理汇总了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);
}