You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stuart Attenborrow edited this page Jun 1, 2018
·
7 revisions
This feature enables you to map multiple queries with only one call to the database. The FetchMultiple method returns a Tuple, List>.
Support: This is only supported on databases which can return multiple result sets, eg. NextResult() on IDataReader is implemented. Sql Server and Postgresql via Npgsql support this.
IDatabasedb=newDatabase("connStringName");Tuple<List<User>,List<Address>>data=db.FetchMultiple<User,Address>("select * from users;select * from addresses;");varusers=data.Item1;varaddresses=data.Item2;
This can be further simplified using C# 7 syntax for deconstructing tuples:
IDatabasedb=newDatabase("connStringName");var(users,addresses)=db.FetchMultiple<User,Address>("select * from users;select * from addresses;");