{"repo":"jitbit/MapDataReader","free":true,"listed":false,"github":"https://github.com/jitbit/MapDataReader","clone":"git clone https://github.com/jitbit/MapDataReader.git","description":"Super fast mapping DataReader to strongly typed object, Using AOT source generator.","language":"C#","stars":81,"topics":["csharp-sourcegenerator","datareader","orm","reflection"],"license":"MIT","category":"databases-storage","readme_excerpt":"MapDataReader Super fast mapping DataReader to a strongly typed object. High performance, lighweight (12Kb dll), uses AOT source generation and no reflection, mapping code is generated at compile time. Benchmarks 20X faster than using reflection, even with caching. Benchmark for a tiny class with 5 string properties: Method Mean Error StdDev Gen0 Allocated --------------- ----------: ----------: ---------: -------: ----------: Reflection 951.16 ns 15.107 ns 0.828 ns 0.1459 920 B MapDataReader 44.15 ns 2.840 ns 0.156 ns 0.0089 56 B Install via Nuget Usage with IDataReader Some notes for the above The ToMyClass() method above - is an IDataReader extension method generated at compile time. You can even \"go to definition\" in Visual Studio and examine its code. The naming convention is ToCLASSNAME() we can't use generics here, since is not part of method signatures in C# (considered in later versions of C#). If you find a prettier way - please contribute! Maps properies with public setters only. The datareader is being closed after mapping, so don't reuse it. Supports enum properties based on int and other implicit casting (sometimes a DataReader may decide to return byte for small integer database value, and it maps to int perfectly via some unboxing magic) Properly maps DBNull to null . Complex-type properties may not work. Bonus API: SetPropertyByName This package also adds a super fast SetPropertyByName extension method generated at compile time for your class. Usage: Method M","default_branch":null,"files":null,"tree":[],"storefront":"/r/jitbit","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/jitbit/MapDataReader/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}