This allows more flexible use of ToSql in generic contexts by allowing references to be used for encoding.