Documentation

Query

Run Method

Syntax:

public IEnumerable<T> Run<T>(string sql, dynamic parameters = null)

Parameters:

Parameter Type Description
sql string The SQL to execute
parameters dynamic A dynamic object containing additional parameters, if any

Return value:

Type Description
IEnumerable<T> The enumerable list of returned objects represented by T

Examples:

@{
    // select birthdays for the current month for users in the system
    var result = Query.Run<dynamic>("select u.ContentId, FirstName, LastName, Birthday from [user] u inner join content c on u.contentid = c.contentid where c.deleted = 0 and u.isactive = 1 and u.BirthdayDisplay <> 3 and month(birthday) = month(getutcdate()) order by day(birthday) asc"); 
}