Skip to content
Adam O'Neil edited this page Dec 11, 2019 · 22 revisions

I know that inline SQL is a divisive topic. I love and use Linq to objects often, but have never enjoyed Linq to Entities because I don't like how it handles dynamic criteria, its strange outer join syntax, and the complications around debugging and working with generated SQL. At the same time, it's true that thoughtless use of inline SQL brings significant liabilities to a code base. With this in mind, I created Dapper.QX as both a productivity layer and testing framework for inline SQL. I based it on Dapper since it handles low-level query execution and mapping of results to CLR types really well.

Using Dapper.QX revolves around using the Query<TResult> class. Use this to encapsulate a SQL statement along with its available parameters. Here's a very simple case:

public class Employees : Query<EmployeeResult>
{
    public Employees() : base("SELECT * FROM [dbo].[Emplpoyee]")
}
Clone this wiki locally