internal SLTupleSet Clone()
        {
            var ts = new SLTupleSet();

            ts.MaxRank       = MaxRank;
            ts.SetDefinition = SetDefinition;
            ts.SortType      = SortType;
            ts.QueryFailed   = QueryFailed;

            ts.Tuples = new List <SLTuplesType>();
            foreach (var tt in Tuples)
            {
                ts.Tuples.Add(tt.Clone());
            }

            ts.HasSortByTuple = HasSortByTuple;
            ts.SortByTuple    = SortByTuple.Clone();

            return(ts);
        }
Beispiel #2
0
        internal void FromTupleCache(TupleCache tc)
        {
            SetAllNull();

            // I decided to do this one by one instead of just running through all the child
            // elements. Mainly because this seems safer... so complicated! It's just a pivot table
            // for goodness sakes...

            if (tc.Entries != null)
            {
                Entries.FromEntries(tc.Entries);
                HasEntries = true;
            }

            if (tc.Sets != null)
            {
                SLTupleSet ts;
                using (var oxr = OpenXmlReader.Create(tc.Sets))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(TupleSet))
                        {
                            ts = new SLTupleSet();
                            ts.FromTupleSet((TupleSet)oxr.LoadCurrentElement());
                            Sets.Add(ts);
                        }
                    }
                }
            }

            if (tc.QueryCache != null)
            {
                SLQuery q;
                using (var oxr = OpenXmlReader.Create(tc.QueryCache))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(Query))
                        {
                            q = new SLQuery();
                            q.FromQuery((Query)oxr.LoadCurrentElement());
                            QueryCache.Add(q);
                        }
                    }
                }
            }

            if (tc.ServerFormats != null)
            {
                SLServerFormat sf;
                using (var oxr = OpenXmlReader.Create(tc.ServerFormats))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(ServerFormat))
                        {
                            sf = new SLServerFormat();
                            sf.FromServerFormat((ServerFormat)oxr.LoadCurrentElement());
                            ServerFormats.Add(sf);
                        }
                    }
                }
            }
        }