Friday, March 20, 2015

Hyperfast reflection in mapping was explained to me by a coworker today

Conceptually, when one is to map the dataset from a sproc to a POCO at C# in the name of decoupling an entity from the data implementation, this provides a way to do so wherein the C# type is crawled for its setters ONCE by reflection and a dictionary of actions is then crafted to actual set the getsetters. Mapping rules attempt to cast table columns to the dictionary keys to hydrate objects, and for the most part this behaves just as fast as if there were no reflection to begin with as the upfront performance hit is the only performance hit. When writing instead of reading, you don't really need the mapping. You can just call a sproc. You really only need to get back the id of a new entity if you are really ORMing-out and you may find that you don't really need to. In many apps, when adding a new object at a list of objects the user is just taken back the list and there is not immediately a greater workflow happening with the newly created thing. If you select the thing that was created a second time for editing, well, then you'd obviously have the id then.

No comments:

Post a Comment