Exemplo n.º 1
0
 public Exceptional<Boolean> RemoveUndefinedAttribute(String myName, DBObjectStream myObject)
 {
     return myObject.RemoveUndefinedAttribute(myName, this);
 }
Exemplo n.º 2
0
        private Exceptional<Tuple<String, TypeAttribute, IObject>> ApplyAssignUndefinedAttribute(DBContext myDBContext, DBObjectStream myDBObjectStream, GraphDBType myGraphDBType)
        {
            Dictionary<String, Tuple<TypeAttribute, IObject>> attrsForResult = new Dictionary<String, Tuple<TypeAttribute, IObject>>();

            #region undefined attributes

            var newValue = GetValueForAttribute(myDBObjectStream, myDBContext, myGraphDBType);
            if (newValue.Failed())
            {
                return new Exceptional<Tuple<string, TypeAttribute, IObject>>(newValue);
            }

            if (myDBObjectStream.ContainsUndefinedAttribute(AttributeIDChain.UndefinedAttribute, myDBContext.DBObjectManager))
            {
                var removeResult =myDBObjectStream.RemoveUndefinedAttribute(AttributeIDChain.UndefinedAttribute, myDBContext.DBObjectManager);
                if (removeResult.Failed())
                {
                    return new Exceptional<Tuple<string, TypeAttribute, IObject>>(removeResult);
                }
            }

            //TODO: change this to a more handling thing than KeyValuePair
            var addExcept = myDBContext.DBObjectManager.AddUndefinedAttribute(AttributeIDChain.UndefinedAttribute, newValue.Value, myDBObjectStream);

            if (addExcept.Failed())
            {
                return new Exceptional<Tuple<String, TypeAttribute, IObject>>(addExcept);
            }

            //sthChanged = true;

            attrsForResult.Add(AttributeIDChain.UndefinedAttribute, new Tuple<TypeAttribute, IObject>(null, newValue.Value));

            #endregion

            return new Exceptional<Tuple<String, TypeAttribute, IObject>>(new Tuple<String, TypeAttribute, IObject>(AttributeIDChain.UndefinedAttribute, AttributeIDChain.LastAttribute, newValue.Value));
        }