public static AccountCollection Where(WhereDelegate <AccountColumns> where, OrderBy <AccountColumns> orderBy = null, Database database = null) { database = database ?? Db.For <Account>(); var results = new AccountCollection(database, database.GetQuery <AccountColumns, Account>(where, orderBy), true); return(results); }
/// <summary> /// Return every record in the Account table. /// </summary> /// <param name="database"> /// The database to load from or null /// </param> public static AccountCollection LoadAll(Database database = null) { SqlStringBuilder sql = new SqlStringBuilder(); sql.Select <Account>(); Database db = database ?? Db.For <Account>(); var results = new AccountCollection(sql.GetDataTable(db)); results.Database = db; return(results); }
private static Account OneOrThrow(AccountCollection c) { if (c.Count == 1) { return(c[0]); } else if (c.Count > 1) { throw new MultipleEntriesFoundException(); } return(null); }
/// <summary> /// This method is intended to respond to client side Qi queries. /// Use of this method from .Net should be avoided in favor of /// one of the methods that take a delegate of type /// WhereDelegate<AccountColumns>. /// </summary> /// <param name="where"></param> /// <param name="database"></param> public static AccountCollection Where(QiQuery where, Database database = null) { var results = new AccountCollection(database, Select <AccountColumns> .From <Account>().Where(where, database)); return(results); }