LINQ的Union报错nostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request. System.InvalidOperationException: The binary operator Equal is not defined for t

nostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request.
System.InvalidOperationException: The binary operator Equal is not defined for the types 'System.Nullable`1[System.Int64]' and 'System.Object'.

解决方法:

多个IQuerable类型在做Union操作的时候应该对填充属性的顺序要统一.

 

select 的时候不要用三元表达式
UserName = d == null ? "官方资源" : d.UserName,

 

你可能感兴趣的:(LINQ的Union报错nostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request. System.InvalidOperationException: The binary operator Equal is not defined for t)