Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
When your development reaches a certain stage, you may find yourself needing to tune some of your queries or maybe create a custom field that represents part of your own problem domain as an intrinsic part of the Mapper model. This section addresses these types of concerns and shows you how to implement query logging with Mapper so you can see what SQL is being executed in the lifecycle of a request. You’ll also see how to grab metrics from query executions, which you could either log or pass to a monitoring tool. In addition, you’ll see how you can use Mapper to construct transactions containing operations that must all succeed or all roll back.
First up, though, let’s take a look at the query logging support that Mapper offers and build a sample atop the entities you created earlier in this chapter.