Dapper icon indicating copy to clipboard operation
Dapper copied to clipboard

Use source generators instead of reflection

Open musictopia2 opened this issue 4 years ago • 1 comments

I notice that one area where dapper can still be maybe too slow is it uses reflection to map to objects which is too slow. I would suggest the possibility of using source generators so a person can have as fast performance as possible.

musictopia2 avatar Jan 05 '22 13:01 musictopia2

See https://github.com/DapperLib/DapperAOT/

Totally agree; have done some initial exploration; needs dedicated thought.

mgravell avatar Jan 05 '22 16:01 mgravell

While Marc and the team are still working on this, you can use our source-generator-based mapper (datareader-to-object) here https://github.com/jitbit/MapDataReader/

You can use it with Dapper too, by overloading the Query<T> extension method (see the example in the Readme)

alex-jitbit avatar Oct 24 '22 19:10 alex-jitbit