0

我有一个查询:

SELECT "string", Field, Field2, etc. 

我想在实体框架中模仿这一点,以便它可以与查询结果一起使用:

林克...

select new 
{
    "STRING", //this is what I want to add to this.                      
    shows.ShowId,
    shows.Title,
    episodes.EpisodeId,
    episodes.EpisodeTitle,
    genres.GenreDescription,
    showTypes.ShowTypeDescription,
    directors.Name,
    episodes.SeasonEpisode
};

如果我尝试在那里添加一个简单的字符串,我会得到:

'匿名类型投影初始化程序应该是简单的名称或成员访问表达式'

4

1 回答 1

1

尝试

select new 
{
    value = "STRING", //this is what I want to add to this.                      
    shows.ShowId,
    shows.Title,
    episodes.EpisodeId,
    episodes.EpisodeTitle,
    genres = genres.GenreDescription,
    showTypes.ShowTypeDescription,
    directors.Name,
    episodes.SeasonEpisode
};
于 2013-06-20T02:28:13.040 回答