在EF中的SELECT中带有返回列的Concat字符串

时间:2011-08-17 21:17:35

标签: c# linq entity-framework

请参阅代码。

return from org in context.Organizations
                   select new
                   {
                       PlaceId = org.OrganizationId,
                       org.Name
                   };

如何在上面的查询中使用Name连接一些字符串,例如

return from org in context.Organizations
                   select new
                   {
                       PlaceId = org.OrganizationId,
                       org.Name + "Some string will go here" // Error: How to do this
                   };

感谢。

1 个答案:

答案 0 :(得分:2)

也许?

select new
{
    PlaceId = org.OrganizationId,
    Name = org.Name + "Some string will go here" // Error: How to do this
};