Dapper SQL Builder wo
using (IDbConnection connection = new SqlConnection(ConnectionString))
{
var builder = new SqlBuilder();
builder.Select("Id");
builder.Select("FirstName");
builder.Select("LastName");
DynamicParameters parameters = new DynamicParameters();
parameters.Add("@MyParam", id, DbType.Int32, ParameterDirection.Input);
builder.Where("Id = @MyParam", parameters);
var builderTemplate = builder.AddTemplate("Select /**select**/ from Authors /**where**/ ");
var author = connection.Query<Author>(builderTemplate.RawSql, builderTemplate.Parameters).FirstOrDefault();
return author;
}
Aravind T A