Esempio n. 1
0
        public void CreateRelationship(string master, string type, string slave, string created, string updated)
        {
            var comm1 = new NpgsqlCommand("insert into relationship values(@master,@type,@slave,@created,@updated)", _connection);

            comm1.Parameters.AddWithValue("@master", master);
            comm1.Parameters.AddWithValue("@type", type);
            comm1.Parameters.AddWithValue("@slave", slave);
            comm1.Parameters.AddWithValue("@created", created);
            comm1.Parameters.AddWithValue("@updated", updated);
            comm1.ExecuteNonQuery();
            DBFactory.AddMemcachedRelationship(master, slave);
        }
Esempio n. 2
0
        public XElement GetChildren(string parentId)
        {
            var kids = new XElement("Children");

            var kidsList = DBFactory.GetMemcachedRelationship(parentId);

            if (kidsList != null && kidsList.Count > 0)
            {
                foreach (var directKid in kidsList)
                {
                    kids.Add(Find(directKid));
                }
                return(kids);
            }

            var directKids = GetKids(parentId);

            foreach (var directKid in directKids)
            {
                DBFactory.AddMemcachedRelationship(parentId, directKid);
                kids.Add(Find(directKid));
            }
            return(kids);
        }