/// <summary>
 /// Attempts to retrieve the first object that matches the query from the table
 /// associated with the specified type.
 /// </summary>
 /// <param name="map">
 /// The TableMapping used to identify the table.
 /// </param>
 /// <param name="query">
 /// The fully escaped SQL.
 /// </param>
 /// <param name="args">
 /// Arguments to substitute for the occurences of '?' in the query.
 /// </param>
 /// <returns>
 /// The object that matches the given predicate or null
 /// if the object is not found.
 /// </returns>
 public Task <object> FindWithQueryAsync(TableMapping map, string query, params object[] args)
 {
     return(ReadAsync(conn => conn.FindWithQuery(map, query, args)));
 }
 /// <summary>
 /// Attempts to retrieve an object with the given primary key from the table
 /// associated with the specified type. Use of this method requires that
 /// the given type have a designated PrimaryKey (using the PrimaryKeyAttribute).
 /// </summary>
 /// <param name="pk">
 /// The primary key.
 /// </param>
 /// <param name="map">
 /// The TableMapping used to identify the table.
 /// </param>
 /// <returns>
 /// The object with the given primary key. Throws a not found exception
 /// if the object is not found.
 /// </returns>
 public Task <object> GetAsync(object pk, TableMapping map)
 {
     return(ReadAsync(conn => conn.Get(pk, map)));
 }
 /// <summary>
 /// Attempts to retrieve an object with the given primary key from the table
 /// associated with the specified type. Use of this method requires that
 /// the given type have a designated PrimaryKey (using the PrimaryKeyAttribute).
 /// </summary>
 /// <param name="pk">
 /// The primary key.
 /// </param>
 /// <param name="map">
 /// The TableMapping used to identify the table.
 /// </param>
 /// <returns>
 /// The object with the given primary key or null
 /// if the object is not found.
 /// </returns>
 public Task <object> FindAsync(object pk, TableMapping map)
 {
     return(ReadAsync(conn => conn.Find(pk, map)));
 }
 /// <summary>
 /// Deletes all the objects from the specified table.
 /// WARNING WARNING: Let me repeat. It deletes ALL the objects from the
 /// specified table. Do you really want to do that?
 /// </summary>
 /// <param name="map">
 /// The TableMapping used to identify the table.
 /// </param>
 /// <returns>
 /// The number of objects deleted.
 /// </returns>
 public Task <int> DeleteAllAsync(TableMapping map, bool shouldnotify = true)
 {
     return(WriteAsync(conn => conn.DeleteAll(map, shouldnotify)));
 }
 /// <summary>
 /// Deletes the object with the specified primary key.
 /// </summary>
 /// <param name="primaryKey">
 /// The primary key of the object to delete.
 /// </param>
 /// <param name="map">
 /// The TableMapping used to identify the table.
 /// </param>
 /// <returns>
 /// The number of objects deleted.
 /// </returns>
 public Task <int> DeleteAsync(object primaryKey, TableMapping map)
 {
     return(WriteAsync(conn => conn.Delete(primaryKey, map)));
 }
 /// <summary>
 /// Executes a "drop table" on the database.  This is non-recoverable.
 /// </summary>
 /// <param name="map">
 /// The TableMapping used to identify the table.
 /// </param>
 public Task <int> DropTableAsync(TableMapping map)
 {
     return(WriteAsync(conn => conn.DropTable(map)));
 }
 /// <summary>
 /// Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
 /// in the command text for each of the arguments and then executes that command.
 /// It returns each row of the result using the specified mapping. This function is
 /// only used by libraries in order to query the database via introspection. It is
 /// normally not used.
 /// </summary>
 /// <param name="map">
 /// A <see cref="TableMapping"/> to use to convert the resulting rows
 /// into objects.
 /// </param>
 /// <param name="query">
 /// The fully escaped SQL.
 /// </param>
 /// <param name="args">
 /// Arguments to substitute for the occurences of '?' in the query.
 /// </param>
 /// <returns>
 /// An enumerable with one result for each row returned by the query.
 /// The enumerator will call sqlite3_step on each call to MoveNext, so the database
 /// connection must remain open for the lifetime of the enumerator.
 /// </returns>
 public Task <IEnumerable <object> > DeferredQueryAsync(TableMapping map, string query, params object[] args)
 {
     return(ReadAsync(conn => (IEnumerable <object>)conn.DeferredQuery(map, query, args).ToList()));
 }
Beispiel #8
0
 public NotifyTableChangedEventArgs(TableMapping table, NotifyTableChangedAction action)
 {
     Table  = table;
     Action = action;
 }