示例#1
0
        internal void Update <T>(T obj)
        {
            DictionaryOrientDBEntity document;

            if (obj is OrientDBEntity)
            {
                document = (obj as OrientDBEntity).ToDictionaryOrientDBEntity();
            }
            else
            {
                document = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);
            }

            if (!string.IsNullOrEmpty(document.OClassName))
            {
                Class(document.OClassName);
            }

            if (document.ORID != null)
            {
                Record(document.ORID);
            }

            Set(document);
        }
示例#2
0
        internal void Delete <T>(T obj)
        {
            DictionaryOrientDBEntity document;

            if (obj is OrientDBEntity)
            {
                document = (obj as OrientDBEntity).ToDictionaryOrientDBEntity();
            }
            else
            {
                document = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);
            }

            if (!string.IsNullOrEmpty(document.OClassName))
            {
                Class(document.OClassName);
            }
            else
            {
                throw new OrientDBException(OrientDBExceptionType.Query, "Document doesn't contain OClassName value.");
            }

            if (document.ORID != null)
            {
                // check if the @rid is correct in real example
                Where("@rid");

                Equals(document.ORID);
            }
        }
示例#3
0
        public IOCreateEdge Edge <T>(T obj)
        {
            DictionaryOrientDBEntity document;

            if (obj is OrientDBEntity)
            {
                document = (obj as OrientDBEntity).ToDictionaryOrientDBEntity();
            }
            else
            {
                document = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);
            }

            string className = document.OClassName;

            if (typeof(T) == typeof(Edge))
            {
                className = "E";
            }
            else if (string.IsNullOrEmpty(document.OClassName))
            {
                throw new OrientDBException(OrientDBExceptionType.Query, "Document doesn't contain OClassName value.");
            }

            _sqlQuery.Edge(className);
            _sqlQuery.Set(document);

            return(this);
        }
 public IOCreateDocument Document <T>(T obj)
 {
     if (obj is OrientDBEntity)
     {
         _document = (obj as OrientDBEntity).ToDictionaryOrientDBEntity();
     }
     else
     {
         _document = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);
     }
     return(this);
 }
示例#5
0
        public IOCreateEdge Set <T>(T obj)
        {
            var document = obj is OrientDBEntity ? obj as DictionaryOrientDBEntity : OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);

            // TODO: go also through embedded fields
            foreach (KeyValuePair <string, object> field in document.Fields)
            {
                // set only fields which doesn't start with @ character
                if ((field.Key.Length > 0) && (field.Key[0] != '@'))
                {
                    Set(field.Key, field.Value);
                }
            }

            return(this);
        }
        public IOCreateVertex Vertex <T>(T obj)
        {
            if (obj is OrientDBEntity)
            {
                _document = (obj as OrientDBEntity).ToDictionaryOrientDBEntity();
            }
            else
            {
                _document = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);
            }

            if (string.IsNullOrEmpty(_document.OClassName))
            {
                throw new OrientDBException(OrientDBExceptionType.Query, "Document doesn't contain OClassName value.");
            }

            return(this);
        }
示例#7
0
        private static OrientDBEntity ToODocument <T>(T obj)
        {
            DictionaryOrientDBEntity document;

            if (obj is IDictionary <string, object> )
            {
                document = obj as DictionaryOrientDBEntity;
            }
            else
            {
                document = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);
            }

            if (document.ORID == null)
            {
                throw new OrientDBException(OrientDBExceptionType.Query, "Document doesn't contain ORID value.");
            }
            return(document);
        }
        public OSqlDeleteEdge To <T>(T obj)
        {
            DictionaryOrientDBEntity document;

            if (obj is OrientDBEntity)
            {
                document = (obj as OrientDBEntity).ToDictionaryOrientDBEntity();
            }
            else
            {
                document = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);
            }

            if (document.ORID == null)
            {
                throw new OrientDBException(OrientDBExceptionType.Query, "Document doesn't contain ORID value.");
            }

            _sqlQuery.To(document.ORID);

            return(this);
        }
示例#9
0
        internal void Set <T>(T obj)
        {
            DictionaryOrientDBEntity document;

            if (obj is OrientDBEntity)
            {
                document = (obj as OrientDBEntity).ToDictionaryOrientDBEntity();
            }
            else
            {
                document = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);
            }

            // TODO: go also through embedded fields
            foreach (KeyValuePair <string, object> field in document.Fields)
            {
                // set only fields which doesn't start with @ character
                if ((field.Key.Length > 0) && (field.Key[0] != '@'))
                {
                    Set(field.Key, field.Value);
                }
            }
        }
示例#10
0
        public IOCreateVertex Vertex <T>(T obj)
        {
            DictionaryOrientDBEntity document;

            if (obj is OrientDBEntity)
            {
                document = obj as DictionaryOrientDBEntity;
            }
            else
            {
                document = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj);
            }

            if (string.IsNullOrEmpty(document.OClassName))
            {
                throw new OrientDBException(OrientDBExceptionType.Query, "Document doesn't contain OClassName value.");
            }

            _sqlQuery.Vertex(document.OClassName);
            _sqlQuery.Set(document);

            return(this);
        }
示例#11
0
 public IOCreateEdge From <T>(T obj)
 {
     _source = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj).ORID;
     return(this);
 }
示例#12
0
 public IOCreateEdge To <T>(T obj)
 {
     _dest = OrientDBEntityExtensions.ToDictionaryOrientDBEntity(obj).ORID;
     return(this);
 }