怎么用linq映射实体类
publicList<Sys_VehicleManage>GetList(){using(DataContextDataContextcontext=newDataCon...
public List<Sys_VehicleManage> GetList() { using (DataContextDataContext context = new DataContextDataContext()) { var query = from c in context.Sys_VehicleManage select new Sys_VehicleManage { VehicleID = c.VehicleID, VehicleNumber = c.VehicleNumber }; return query.Where(p=>p.VehicleID==1).ToList(); } } 如何传入一个匿名实体,返回一个匿名实体;怎么传入多个实体,返回多个实体的集合呢?
展开
展开全部
public List<衡歼T> GetList()
var query = from c in context.Sys_VehicleManage select new Sys_VehicleManage { VehicleID = c.VehicleID, VehicleNumber = c.VehicleNumber }; return query.Where(p=>p.VehicleID==1).ToList<T>咐者冲嫌渗();
try it
var query = from c in context.Sys_VehicleManage select new Sys_VehicleManage { VehicleID = c.VehicleID, VehicleNumber = c.VehicleNumber }; return query.Where(p=>p.VehicleID==1).ToList<T>咐者冲嫌渗();
try it
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询