public void SetUp() { dbFileName = Path.GetTempFileName() + ".db"; var connStr = String.Format("Data Source={0};FailIfMissing=false;Pooling=False;", dbFileName); Dalc = new DbDalc(new SQLiteDalcFactory(), connStr); var usersViewSql = @" select @SqlFields from users u left join roles r on (u.role=r.id) @SqlWhere[where {0}] @SqlOrderBy[order by {0};order by u.id desc] " .Trim(); Dalc.CommandGenerator = new DbCommandGenerator(Dalc.DbFactory) { Views = new[] { new DbDalcView("users_view", usersViewSql, "u.*,r.role as role_name", "count(u.id)") { FieldMapping = new Dictionary <string, string>() { { "role_name", "r.role" } } }, new DbDalcView("users2_view", usersViewSql, "u.*,r.role as role_name@customParam[, {0}]", "count(u.id)") { FieldMapping = new Dictionary <string, string>() { { "role_name", "r.role" } } } } }; // create tables if not exist Dalc.ExecuteNonQuery(@" CREATE TABLE [users] ( [id] INTEGER PRIMARY KEY AUTOINCREMENT, [name] TEXT, [role] INTEGER ) " ); Dalc.ExecuteNonQuery(@" CREATE TABLE [roles] ( [id] INTEGER PRIMARY KEY AUTOINCREMENT, [role] TEXT ) " ); Dalc.Insert("users", new Hashtable { { "name", "Mike" }, { "role", 1 } }); Dalc.Insert("users", new Hashtable { { "name", "Joe" }, { "role", 1 } }); Dalc.Insert("users", new Hashtable { { "name", "Stas" }, { "role", 2 } }); Dalc.Insert("users", new Hashtable { { "name", "WUserToDelete" }, { "role", 3 } }); Dalc.Insert("roles", new Hashtable { { "role", "admin" } }); Dalc.Insert("roles", new Hashtable { { "role", "user" } }); Dalc.Insert("roles", new Hashtable { { "role", "toDelete" } }); }