If I have a simple SQL query such as:
string sql = "SELECT [NonUniqueString] as Foo, [StringValue] as Bar FROM Table";
and I want to map it to a
Lookup<string, string> object how would I do this with Dapper?
ILookup<string, string> lookup = connection.Query<Table>(sql) .ToLookup(x => x.NonUniqueString, x => x.StringValue);
This is how I currently do the query and mapping, perhaps it could be done in a easier way.
IEnumerable<dynamic> result = await dbConnection.QueryAsync(sql); ILookup<string, string> xxx = result.ToLookup(k => (string)k.Foo, v => (string)v.Bar); Lookup<string, string> yyy = (Lookup<string, string>)xxx;