News for hackers. Stuff that matters.
Re:Dapper.NET - "micro-ORM" that poweres StackOverflow goes ... by singular on Tuesday April 05, 2011 @04:32AM (#2410162)
Interesting use of code generation - pretty cool, oft unused part of .net/C#. Also interesting how it's designed to be a drop-in single C# file, that often seems the easier way of getting functionality into a project, side-stepping DLL version issues.
Re:Dapper.NET - "micro-ORM" that poweres StackOverflow goes ... by kenjackson on Tuesday April 05, 2011 @11:04AM (#2411193)
Looking at the dynamic code gen... is it necessary? Can't they just use a method that takes 'type' and the set of properties as arguments? I'm sure I'm missing something, but don't see it at the moment.
Re:Dapper.NET - "micro-ORM" that poweres StackOverflow goes ... by darrenkopp on Tuesday April 05, 2011 @11:37AM (#2411341)
it's an optimization so that you don't die from the reflection cost.
Re:Dapper.NET - "micro-ORM" that poweres StackOverflow goes ... by kenjackson on Tuesday April 05, 2011 @11:42AM (#2411361)
OK, I buy that.
Re:Dapper.NET - "micro-ORM" that poweres StackOverflow goes ... by glhaynes on Tuesday April 05, 2011 @03:23PM (#2412328)
I assume they've tested it out and aren't just assuming that the reflection would be a killer... but...
Re:Dapper.NET - "micro-ORM" that poweres StackOverflow goes ... by bad_user on Tuesday April 05, 2011 @04:52AM (#2410207)
I don't see code-generation; what are you referring to?
Re:Dapper.NET - "micro-ORM" that poweres StackOverflow goes ... by singular on Tuesday April 05, 2011 @04:53AM (#2410210)
I mean dynamic code generation at runtime, rather than actually outputting text :-)

E.g. CreateParamInfoGenerator() at line 208.

Re:Dapper.NET - "micro-ORM" that poweres StackOverflow goes ... by bad_user on Tuesday April 05, 2011 @06:16AM (#2410368)
Yes, you're right. It's pretty cool.

Also, if you're looking for other cool samples, there's a chapter in "Beautiful Code" by Charles Petzold you may find interesting.

Re:Dapper.NET - "micro-ORM" that poweres StackOverflow goes ... by arethuza on Tuesday April 05, 2011 @05:39AM (#2410297)
It looks like it is using the Reflection Emit capabilities of .Net:

http://msdn.microsoft.com/en-us/library/8ffc3x75.aspx