I have a problem I can't get out of...
I'm developing an android project, and have mapped all my entities. It all seems to function fine as long as i'm reading or inserting new records, but when I try to SaveOrUpdate an existing record (using the same method that saves a new record), I get an error stating
Mono.Data.Sqlite.SqliteException: SQLite error
Insufficient parameters supplied to the command
at Mono.Data.Sqlite.SqliteStatement.BindParameter (Int32 index, Mono.Data.Sqlite.SqliteParameter param) [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteStatement.BindParameters () [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteCommand.BuildNextCommand () [0x00000] in <filename unknown>:0
I made a small project with 1 entity with 2 fields, and I constantly get this error.
this is my test class:
public class Customer
{
public int CustomerID { get; set; }
public string name { get; set; }
}
this is my mapping:
d.Entity<Customer> (e => {
e.Table ("Customers");
e.Id (x => x.CustomerID);
});
This is my test code that fails:
Customer customer = null;
using (var sess = Repository.sessionFactory.Create()) {
sess.Open ();
customer = new Customer ();
sess.SaveOrUpdate (customer);
int id = customer.CustomerID;
customer = sess.Get<Customer> (id);
sess.SaveOrUpdate (customer);
}
as you can see I'm just creating a new customer, I reload it and saving it again triggers the error.
I stepped through the source code. It seems the update query is generated fine with all parameters correctly set, but fails.
Any hint on how to solve this?
Thanks.
Fabio