示例#1
0
        public static Entity GetEntityFromDataSetV2 <Entity>(DataSet ds) where Entity : class
        {
            DataTable dt = ds.Tables[0];// 获取到ds的dt

            if (dt.Rows.Count > 0)
            {
                return(FillAdapter <Entity> .AutoFill(dt.Rows[0]));
            }
            return(default(Entity));
        }
示例#2
0
        public static List <Entity> GetListFromDataSetV2 <Entity>(DataSet ds) where Entity : class
        {
            List <Entity> list = new List <Entity>();
            DataTable     dt   = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    Entity entity = FillAdapter <Entity> .AutoFill(row);

                    list.Add(entity);
                }
            }
            return(list);
        }