Пример #1
0
        /// <summary>
        /// 写入到string
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">数据</param>
        /// <returns></returns>
        public string WriteString <T>(List <T> source)
        {
            List <List <DataColumn> > rows = new List <List <DataColumn> >();
            var members = DataTableTool.GetMemberInfo(typeof(T));

            source.ForEach((t) => {
                var row = _explainer.GetColumns <T>(t, members);
                rows.Add(row);
            });
            return(WriteString(members.Values.ToList(), rows));
        }
Пример #2
0
        /// <summary>
        /// 获取一张表数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public List <T> Get <T>()
        {
            List <T> ts      = new List <T>();
            var      members = DataTableTool.GetMemberInfo(typeof(T));

            _rows.ForEach((cols) =>
            {
                T t = _explainer.CreatInstance <T>(cols, members);
                if (t != null)
                {
                    ts.Add(t);
                }
            });
            return(ts);
        }