1

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.

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
MuhanadY
  • 752
  • 1
  • 12
  • 40
  • this was taken from the solution in [link](http://stackoverflow.com/questions/6379155/help-with-multi-mapper-to-create-object-hierarchy/6380756#6380756) – MuhanadY Oct 09 '13 at 07:23

1 Answers1

3

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
Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
Phillip Ngan
  • 15,482
  • 8
  • 63
  • 79