Dapper multi-table (three tables above) query

  Encountered in the use of multi-table queries Dappr do queries, mostly before two tables, three tables appear now or more. When two tables using splitOn split, the default value is splitOn Id. When I was building a database, the primary key ID is not always the name. When more than three tables appear difficult to cut, distressed for a while. Then I thought of a way, the use of the sql as a field to create a split.

select a.* ,'' as id,b.*,'' as id,c.* from a left join b on a.aid=b.bid left join c on c.cid=b.bid

  Cutting is still splitOn = "Id", the perfect solution to multi-table query object mapping

Guess you like

Origin www.cnblogs.com/RainbowInTheSky/p/11545088.html