public Entity GetEntityFromDataSetV2 <Entity>(DataSet ds) where Entity : class { if (DbContext.OpenRealExecutionSaveToDb) { DataTable dt = ds.Tables[0];// 获取到ds的dt if (dt.Rows.Count > 0) { return(FillAdapter <Entity> .AutoFill(dt.Rows[0])); } return(default(Entity)); } return(default(Entity)); }
/// <summary> /// ExpressionTree高性能转换DataSet为List集合 /// </summary> /// <typeparam name="Entity"></typeparam> /// <param name="ds"></param> /// <returns></returns> public List <Entity> GetListFromDataSetV2 <Entity>(DataSet ds) where Entity : class { if (DbContext.OpenRealExecutionSaveToDb) { DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { List <Entity> list = new List <Entity>(); foreach (DataRow row in dt.Rows) { Entity entity = FillAdapter <Entity> .AutoFill(row); list.Add(entity); } return(list); } return(default(List <Entity>)); } return(default(List <Entity>)); }