关联表查询的分页时,分页方法Count()执行出错
System.Exception
HResult=0x80131500
Message=Can't write CLR type System.Collections.Generic.List1[System.Int64] with handler type Int64Handler Source=FreeSql StackTrace: 在 FreeSql.Internal.CommonProvider.AdoProvider.LoggerException(IObjectPool1 pool, PrepareCommandResult pc, Exception ex, DateTime dt, StringBuilder logtxt, Boolean isThrowException)
在 FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReaderMultiple(Int32 multipleResult, DbConnection connection, DbTransaction transaction, Action2 fetchHandler, Action2 schemaHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms)
在 FreeSql.Internal.CommonProvider.AdoProvider.ExecuteReader(DbConnection connection, DbTransaction transaction, Action1 fetchHandler, CommandType cmdType, String cmdText, Int32 cmdTimeout, DbParameter[] cmdParms) 在 FreeSql.Internal.CommonProvider.Select0Provider2.ToList[TTuple](String field)
在 FreeSql.Internal.CommonProvider.Select0Provider2.Count() 在 FreeSql.Internal.CommonProvider.Select0Provider2.Count(Int64& count)
Freesql.ALL版本为3.2.651
var oSelect = appUserInfoRepository.Select;
#region 条件查询
oSelect.WhereIf(!string.IsNullOrWhiteSpace(userInfoParam.SearchText), d => d.UserName.Contains(userInfoParam.SearchText) || d.UserAliname.Contains(userInfoParam.SearchText) || d.JobNum.Contains(userInfoParam.SearchText));
oSelect.WhereIf(userInfoParam.IsActivated != null, d => d.IsActivated == userInfoParam.IsActivated);
oSelect.WhereIf(userInfoParam.IsDriver != null, d => d.IsDriver == userInfoParam.IsDriver);
oSelect.WhereIf(userInfoParam.UserPostType != null, d => userInfoParam.UserPostType.Contains(d.UserPostType.Value));
//if (userInfoParam.TaskCodes != null && userInfoParam.TaskCodes.Count > 0) oSelect.Where(@$" e.task_code in ({string.Join(',', userInfoParam.TaskCodes)})");
oSelect.WhereIf(userInfoParam.IsTaskuser != null, d => d.IsTaskuser == userInfoParam.IsTaskuser);
oSelect.WhereIf(userInfoParam.OrgIds != null, d => userInfoParam.OrgIds.Contains(d.OrgId));
#endregion
#region 是否排序
//oSelect.OrderBy(!string.IsNullOrWhiteSpace(userInfoParam.OrderBy), "a." + userInfoParam.OrderBy + (string.IsNullOrWhiteSpace(userInfoParam.OrderByType) ? " asc" : " " + userInfoParam.OrderByType));
#endregion
oSelect.LeftJoin<AppRoleInfo>((a, b) => a.RoleId == b.RoleId);
oSelect.LeftJoin<AppSysOrg>((a, c) => a.OrgId == c.OrgId);
oSelect.LeftJoin<AppUserDriverInfo>((a, d) => a.JobNum == d.JobNum);
oSelect.LeftJoin<AppUserState>((a, e) => a.JobNum == e.JobNum);
#region 是否分页
long dataCount = -1;
List<UserInfoDto> lstResult = null;
if (userInfoParam.PageIndex != null && userInfoParam.PageSize != null)
{
dataCount = oSelect.Count();//执行错误
oSelect.Page(userInfoParam.PageIndex.Value, userInfoParam.PageSize.Value);
}
#endregion
lstResult = await oSelect.ToListAsync(a => new UserInfoDto());
return (dataCount, lstResult);
UserInfoDto 发一下
数据格式错误,List < long > 需要改为long[]
Freesql.All 640升级651之后, oSelect.WhereIf(userInfoParam.OrgIds != null, d => userInfoParam.OrgIds.Contains(d.OrgId));
这个Contains方法有问题了,数据类型搞成List
public IEnumerable
无法重现,还是提供一个console项目吧!