Extending MultiMap supported number of types

dapper

Question

I'm considering extending the MultiMap methods in Dapper to support more than 5 types. Was just curious as to whether there was a technical/performance reason for 5 or was it just an arbitrary number?

Expert Answer

It was fairly arbitrary, and due in part to some implementation particulars that make it pretty awkward to extend arbitrarily - in particular because it uses generics. Changing to an implementation that doesn't use generics would allow a more type-array based approach, but then the lambdas etc (to stitch the data back together) become pretty ugly. There are, IIRC, some pending things in the pull request queue relating to this, but I have not had much available time to review them as of yet.

Also: arguably, if you're doing a query that involves that many types, you're probably already doing something pretty complex; it is hard to expose a friendly API for arbitrarily complex systems.


Popular Answer

Just wanted to make you aware that more types have already been supported. (Just helping you NOT reinvent the wheel)

https://code.google.com/p/dapper-dot-net/issues/detail?id=50

At the bottom of the page you can get a git-hub change.

Matt




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