We're updating the issue view to help you get more done. 

Add parameter of FormattableString as an overload to CreateSQLQuery

Description

.NET 4.6.1 has access to a new type, FormattableString, that can get information from an interpolated string

1 $"hello {name}"

So the idea is that CreateSQLQuery would add an overload taking FormattableString so that this:

1 2 3 4 string filter = "Pus%"; Query query = sess.CreateSQLQuery("SELECT * FROM CATS WHERE NAME like ?") .AddEntity(typeof(Cat)); IList pusList = query.SetString(0, filter).List();

could become:

1 2 3 4 string filter = "Pus%"; IList pusList = sess.CreateSQLQuery($"SELECT * FROM CATS WHERE NAME like {filter}") .AddEntity(typeof(Cat)) .List();

As a benefit, it would also catch any sql injection when interpolation is used.

Environment

None

Status

Assignee

Unassigned

Reporter

Nathan Brown

Labels