小编Àle*_*lex的帖子

实体框架:连接两个表和 where 子句

我在使用实体框架和 PostgreSQL 时遇到问题,有人知道如何连接两个表并将第二个表用作 where 子句吗?

我想在实体框架中执行的选择将在 SQL 中:

SELECT ai.id, ai.title, ai.description, ai.coverimageurl 
FROM app_information ai 
INNER JOIN app_languages al on al.id = ai.languageid
WHERE al.languagecode = 'es'
Run Code Online (Sandbox Code Playgroud)

目前我有这个

var appInformationToReturn = context.app_information
     .Join(
          context.app_language,
          ai => ai.languageid,
          al => al.id,
          (ai, al) => new AppInformation()
          {
               id = ai.id,
               title = ai.title,
               description = ai.description,
               coverimageurl = ai.coverimageurl
          })
     .Where()
     .FirstOrDefault();
Run Code Online (Sandbox Code Playgroud)

我不知道如何构建该where条款。

c# postgresql entity-framework entity-framework-core .net-core

27
推荐指数
2
解决办法
6万
查看次数