/// <summary> /// Insert an item into the table and return the primary key value created for this new item. /// </summary> /// <param name="item"></param> /// <returns></returns> public Int64 InsertItem(TItemType item) { Int64 result = -1; lock (Lock) { using (var statement = sqlConnection.Prepare(GetInsertItemSql())) { this.FillInsertItemStatement(statement, item); SQLiteResult output = statement.Step(); if (output != SQLiteResult.DONE) { string foo = sqlConnection.ErrorMessage(); throw new Exception(output.ToString()); } result = (Int64)sqlConnection.LastInsertRowId(); } } return(result); }