你如何做一个SELECT nonExistentColumn在实体框架5
本文关键字:实体 框架 nonExistentColumn SELECT 何做一 | 更新日期: 2023-09-27 18:19:03
我有一个查询,做:
SELECT "string", Field, Field2, etc.
我想在实体框架中模仿这一点,以便它可以与查询结果一起运行:
LINQ…
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
};
如果我尝试在那里添加一个简单的字符串,我得到:
'匿名类型投影初始化式应该是简单的名称或成员访问表达式'
Try
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
};