/// <summary> /// 判断指定主键Id的记录是否存在——在IIS缓存或数据库中查找 /// </summary> /// <param name="id">主键Id</param> /// <returns></returns> public bool Exist(int id) { if (id <= 0) { return(false); } //判断是否启用缓存 if (CommonBll.IsUseCache()) { return(Exist(x => x.Id == id)); } //从数据库中查找 return(LoginLog.Exists(x => x.Id == id)); }