关于linq:无法创建类型\\’System.Object \\’的常量值。仅原始类型(\\’,例如Int32,

Unable to create a constant value of type 'System.Object'. Only primitive types ('such as Int32,

有人可以告诉我此查询有什么问题吗

1
2
3
4
5
6
7
var result = from m in _ftsDataContext.SubCategories
             join n in _ftsDataContext.Categories
             on m.CategoryID equals n.CategoryID
             select new {
                 SubCategoryID = m.SubCategoryID,
                 Name = n.CategoryName + ' ' + m.SubCategoryName
             };

出现此错误:无法创建类型为System.Object的常量。在此上下文中仅支持基本类型(例如Int32StringGuid)


尝试使用"":

1
Name = n.CategoryName +"" + m.SubCategoryName