0
У меня проблема с dapper при работе с XML-запросом.Параметр dapper sql не работает с запросом xml
Этот запрос работает отлично
SELECT COUNT(1)
FROM Agreements a INNER JOIN
AgreementParts ap ON ap.AgreementId = a.Id
WHERE a.ToRenew = 1
AND ap.AccountId = N'1234'
AND (a.Workflow.exist('//workflow/step/actor[@creator="true" and @mode="position" and text()="POS1"]') = 1 OR
a.Workflow.exist('//workflow/step/actor[@creator="true" and @mode="email" and text()="[email protected]"]') = 1)
Но вызов этот запрос с Dapper и параметрами всегда возвращает 0
exec sp_executesql N'
SELECT COUNT(1)
FROM Agreements a INNER JOIN
AgreementParts ap ON ap.AgreementId = a.Id
WHERE a.ToRenew = 1
AND ap.AccountId = @accountId
AND (a.Workflow.exist(''//workflow/step/actor[@creator="true" and @mode="position" and text()[email protected]]'') = 1 OR
a.Workflow.exist(''//workflow/step/actor[@creator="true" and @mode="email" and text()[email protected]]'') = 1)
',N'@accountId nvarchar(4000),@position nvarchar(4000),@email nvarchar(4000)',@accountId=N'1234',@position=N'POS1',@email=N'[email protected]'
Вот код, я использую, чтобы выполнить запрос:
_dbConnection.Query<int>(toRenewSql, new { accountId = accountId, email = email, position = position })).First();
Жесткий код электронной почты и позиция заставляют запрос работать.