dapper aggregation function error

c# dapper linq

Question

have this aggregation function in my code using Dapper

var sql = (@"SELECT *  
                  FROM [pubs].[dbo].[authors] as a
                  right join pubs.dbo.titleauthor as b 
                  ON a.au_id = b.au_idT");

 var data = connection.QueryMultiple(sql).Map<authors, titleauthor, string>(
     au=> au.au_id,
     tit=> tit.au_idT,
     (au,tits)=>{au.titleauthor=tits};);

there is no cast error and every objects fits well but i keep have this error

} expected or ; expected and Invalid expression term ')'

i have no idea why. any help is appreciated.

Accepted Answer

Swap the } and ;:

var data = connection.QueryMultiple(sql).Map<authors, titleauthor, string>(
     au=> au.au_id,
     tit=> tit.au_idT,
     (au,tits)=>{au.titleauthor=tits;}); // <=== this line


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why