public static async Task RunInWrappedTransactionAsync(this SQLiteAsyncConnection asyncDb, Action <SQLiteConnectionWrapper> action)
        {
            SQLiteConnectionWrapper   connectionWrapper = null;
            Action <SQLiteConnection> wrappedAction     = db =>
            {
                connectionWrapper = Kimchi.CreateConnectionWrapper(db);
                action(connectionWrapper);
            };

            try
            {
                await asyncDb.RunInTransactionAsync(wrappedAction);

                connectionWrapper.Commit();
            }
            catch (Exception e)
            {
                connectionWrapper.Rollback(e);
            }
        }
예제 #2
0
 public virtual void AfterUpdate(SQLiteConnectionWrapper db)
 {
     // Usually we want to do the same thing on insert and on update
     AfterInsert(db);
 }
예제 #3
0
 public virtual void AfterLoad(SQLiteConnectionWrapper db)
 {
     // do nothing
 }
예제 #4
0
 public virtual void BeforeInsert(SQLiteConnectionWrapper db)
 {
     // do nothing
 }