LINQ的Union报错nostics.DeveloperExceptionPageMiddleware

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,

原文地址:https://www.cnblogs.com/wangyinlon/p/11274585.html