/// <summary> /// 根据主键查询实体对应数据 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="id"></param> /// <returns></returns> public virtual T QueryById <T>(object id) { T result = default(T); var dbEntity = DbBuilder.QueryById <T>(id); if (dbEntity == null) { return(result); } using (var reader = DbHelper.ExecuteReader(dbEntity.CommandText, dbEntity.DbParams)) { result = DataReaderToEntity <T>(reader); } return(result); }