コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <returns></returns>
        public Dictionary <string, List <ITable> > Execute <T1, T2>() where T1 : class, ITable, new() where T2 : class, ITable, new()
        {
            Dictionary <string, List <ITable> > result = new Dictionary <string, List <ITable> >();

            try
            {
                Connection.Open();
                var           reader = Command.ExecuteReader();
                List <ITable> data   = new List <ITable>();
                while (reader.Read())
                {
                    T1 t = new T1();
                    t.Parse(reader);
                    data.Add(t);
                }
                result.Add(typeof(T1).Name, data);
                if (reader.NextResult())
                {
                    List <ITable> data2 = new List <ITable>();
                    while (reader.Read())
                    {
                        T2 s = new T2();
                        s.Parse(reader);
                        data2.Add(s);
                    }
                    result.Add(typeof(T2).Name, data2);
                }
            }
            finally
            {
                Connection.Close();
            }
            return(result);
        }