예제 #1
0
 public SqlNode(NodeEntity entity, SqlContentRepository contentRepository)
 {
     this.Entity = entity;
     this.ContentRepository = contentRepository;
     this.ObserverManager = contentRepository.ObserverManager as SqlObserverManager;
     this.QueryManager = contentRepository.QueryManager as SqlQueryManager;
 }
예제 #2
0
        public INode AddNode(string name, string type)
        {
            ValidateRelativeValue(name, "name");

            var names = name.Split('/');
            if (names.Length > 1)
            {
                INode lastNode = AddNode(names[0], type);
                for (int i = 1; i < names.Length; ++i)
                {
                    lastNode = lastNode.AddNode(names[i], type);
                }
                return lastNode;
            }

            var sqlNode = new NodeEntity();
            sqlNode.Name = name;
            sqlNode.NodeId = Entity.Id;
            sqlNode.NodeTypeId = QueryManager.GetNodeType(type).Id;
            sqlNode.AddedDate = DateTime.Now;
            sqlNode.ChangedDate = DateTime.Now;
            sqlNode.Index = GetNumChildren();

            QueryManager.Save(sqlNode);

            return new SqlNode(sqlNode, ContentRepository);
        }