2 ms·
Actually, we use an ORM that is just SQL. I learned a long time ago that I couldn't trust most of the developers I worked with to dispose their ADO.NET objects
by moron4hire 11y ago
Actually, we use an ORM that is just SQL. I learned a long time ago that I couldn't trust most of the developers I worked with to dispose their ADO.NET objects properly, and that given an inch to concatenate strings, they'll take a mile of SQL injection. So years ago I developed a system around const strings (defined in attributes tagged to methods, so you don't have any option, the string must be constant) and reflection.
It's exactly, 100% the code you would write if you were writing ADO.NET code from scratch. It just doesn't give you the option of screwing it up. Stored Procedures get created automatically. You can prototype queries as text queries if you want, before flipping a switch to make them SPs. You don't have to worry about matching parameter names in the SP declaration correctly, because it's drawn from the method signature. The result sets map out to plain, ol' C# classes with 0 effort. And it all runs fast, because it doesn't do any sort of graph traversals to figure out type mappings. It just takes the first layer of reflection and runs the entire mapping against that. Not enough overhead to ever worry about.
And he'd rather be super verbose and just write his own ADO.NET code, for no benefit and a whole lot of error.