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

            if (dt.Rows.Count > 0)
            {
                return(EntityFillAdapter <Entity> .AutoFill(dt.Rows[0]));
            }
            return(default(Entity));
        }
Beispiel #2
0
        public List <Entity> GetListFromDataSet <Entity>(DataSet ds) where Entity : class
        {
            DataTable dt = ds.Tables[0];

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

                    list.Add(entity);
                }
                return(list);
            }
            return(default(List <Entity>));
        }