Dapper.net 使用 where 参数进行内部连接

Dapper.net Inner join with where parameter

我有一个非常简单的 sql 查询,由 dapper.net

执行
  using (var sqlCon = new SqlConnection(Database.ReturnDatabaseConnection()))
        {
            var resultList = sqlCon.Query<UserProfile, UserAddress, UserProfile>(@"

                            UPDATE [User].[User_Profile]
                                SET ProfileStatus = 4
                            WHERE Id = @userId

                            SELECT u.Id [userId], u.Username, u.Age,
                                   u.ProfileStatus,
                                   a.Id [AddressId], a.Country, a.[State], a.City,
                                   a.Latitude, a.Longitude
                            FROM [User].[User_Profile] u
                            INNER JOIN [User].[User_Address] a on u.id = a.UserId", (u, a) =>
                             {
                                 u.UserId = a.UserId;
                                 return u;
                             },
                             splitOn: "UserId"
                             ).AsQueryable();


        }

我要做的是首先更新用户配置文件的状态,然后将用户配置文件加入到用户地址 table 检索几列并填充用户配置文件 class 我一直在关注 this tutorial 并且它看起来很简单,我试图解决的问题是我如何也包含一个 where 语句,这将是

where u.Id = @UserId 

然后将其包含在上述查询中?

WHERE 跟在 FROMJOIN 之后:

SELECT u.Id [userId], u.Username, u.Age,
       u.ProfileStatus,
       a.Id [AddressId], a.Country, a.[State], a.City,
       a.Latitude, a.Longitude
FROM [User].[User_Profile] u
INNER JOIN [User].[User_Address] a on u.id = a.UserId
WHERE u.Id = @UserId 

语法是 here; note that the joins are technically part of the FROM,根据它们在该语法中的位置。