/// <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); }