SQLite net PCL - Simple select

Hoping this will be usefull to someone in my place...

Between the brackets (<>) goes the table name:

db.Query<TableName>("select * from ....");

Some examples that worked for me:

Simple select:

var list = db.Query<MyTableName>("select * from MyTableName");

Select with restrictions:

var list = db.Query<MyTableName>("select * from MyTableName where lastname=? and firstname=?", lastnameValue, firstNameValue);

The accepted answer doesn't really help if you have a custom mapping for the tables name. The "Sql" table name can be found at runtime accessing to the type mapping.

Here an extension method

public static class NativeConnectionExtension
{
    public static List<T> SelectAllFrom<T>(this SQLiteConnection cnn) where T : new()
    {
        var mapping = cnn.GetMapping<T>();
        var result = cnn.Query<T>(String.Format("select * from {0};", mapping.TableName));
        return result;
    }
}