freekh/play-slick — pull request #59 by cvogt (2013-06-28 15:22:26+00:00)
Title: piggybacks slick session onto play request, reducing boilerplate

* renames SlickAction to DBAction (looks more seamless this way and future play users will know what DB means, but may be confused what Slick is)
* DBAction now passes a RequestWithDbSession, which combines a Play Request and a Slick Session to its argument. Two implicit conversions implicitly convert it to either of the two. This way DBAction automatically provides an implicit Session, removing the need for calling withSession explicitly every time. DBAction uses withSession internally, which provides a session object, but opens/fetches a connection lazily only on first use. The session is closed by DBAction when the request ends. To tune performance, users can close the session early at any time using its close() method. Also, users can still use withSession themselves if they want open and close sessions multiple times. This change does not only reduce boilerplate, but also makes it more transparent where databases accesses happen, because it requires a DBAction instead of an Action (unless withSession is used explicitly, which should be needed rarely).