public object SaveNodeWithRelationShip(object entity)
 {
     ParentChildGlue parentRelation = new ParentChildGlue(null, entity, string.Empty);
     _toWalk.Push(parentRelation);
     PersistObjectGraphWithRelationship(_toWalk.Pop());
     return entity;
 }
 public object SaveNodeWithRelationShip(object proxy)
 {
     object entity = ProxyCloner.ConvertProxyToEntity(proxy);
     ParentChildGlue parentRelation = new ParentChildGlue(null, entity, string.Empty);
     _toWalk.Push(parentRelation);
     PersistObjectGraphWithRelationship(_toWalk.Pop());
     return entity;
 }
Beispiel #3
0
        public object SaveNodeWithRelationShip(object proxy)
        {
            object          entity         = ProxyCloner.ConvertProxyToEntity(proxy);
            ParentChildGlue parentRelation = new ParentChildGlue(null, entity, string.Empty);

            _toWalk.Push(parentRelation);
            PersistObjectGraphWithRelationship(_toWalk.Pop());
            return(entity);
        }
        private void PersistObjectGraphWithRelationship(ParentChildGlue parentRelation)
        {
            object entityParent = parentRelation.GetParent();
            object entity = parentRelation.GetChild();
            Node parent = null;

            Node child = _nodeMapper.SaveAndReturnAsNode(entity);
            if (entityParent != null)
            {
                parent = _nodeMapper.SaveAndReturnAsNode(entityParent);
                parent.CreateRelationshipTo(child, parentRelation.GetMemeberName());
            }

            this.QueueDirectChild(entity);

            if (_toWalk.Count == 0) return;
            PersistObjectGraphWithRelationship(_toWalk.Pop());
        }
Beispiel #5
0
        private void Schedule(Object toSchedule, object parent, string memberName)
        {
            if (toSchedule == null)
            {
                return;
            }

            if (toSchedule.GetType().IsArray || toSchedule.GetType() == typeof(IList))
            {
                foreach (Object item in ((Array)toSchedule))
                {
                    Schedule(item, parent, memberName);
                }
            }
            else
            {
                object          entityToSchedule = ProxyCloner.ConvertProxyToEntity(toSchedule);
                ParentChildGlue parentRelation   = new ParentChildGlue(parent, entityToSchedule, memberName);
                _toWalk.Push(parentRelation);
            }
        }
Beispiel #6
0
        private void PersistObjectGraphWithRelationship(ParentChildGlue parentRelation)
        {
            object entityParent = parentRelation.GetParent();
            object entity       = parentRelation.GetChild();
            Node   parent       = null;

            Node child = _nodeMapper.SaveAndReturnAsNode(entity);

            if (entityParent != null)
            {
                parent = _nodeMapper.SaveAndReturnAsNode(entityParent);
                parent.CreateRelationshipTo(child, parentRelation.GetMemeberName());
            }

            this.QueueDirectChild(entity);

            if (_toWalk.Count == 0)
            {
                return;
            }
            PersistObjectGraphWithRelationship(_toWalk.Pop());
        }
        private void Schedule(Object toSchedule, object parent, string memberName)
        {
            if (toSchedule == null) return;

            if (toSchedule.GetType().IsArray || toSchedule.GetType() == typeof(IList))
                foreach (Object item in ((Array)toSchedule))
                    Schedule(item, parent, memberName);
            else
            {
                ParentChildGlue parentRelation = new ParentChildGlue(parent, toSchedule, memberName);
                _toWalk.Push(parentRelation);
            }
        }