I have this code in petapoco
public List<T> Fetch<T>(Sql sql)
{
return Fetch<T>(sql.SQL, sql.Arguments);
}
Which inherently calling Fetch method which takes a string as parameter. Then why do we need sql builder in petapoco?
I have this code in petapoco
public List<T> Fetch<T>(Sql sql)
{
return Fetch<T>(sql.SQL, sql.Arguments);
}
Which inherently calling Fetch method which takes a string as parameter. Then why do we need sql builder in petapoco?
Sql.Builder is a fluent API and gives the ability to conditionally build SQL. Which makes formatting SQL strings easy and provides a mechanism to use proper parameter replacements to protect from SQL injection.
Example not tested
From PetaPoco documentation: