Started trialing the software this afternoon. The sample works fine, but when I try it I get an error when saving my object.
NinjaDbPro db = new NinjaDbPro("TabletDir", "TabletDB");
db.OpenDatabase();
Person person = new Person();
person.PK = 1;
person.Name = "Damien";
db.Save(person); <= ERROR OCCURS HERE
Class is defined as:
public class Person
{
[PrimaryKey]
public int PK { get; set; }
public string Name { get; set; }
}
The problem is you are trying to perform an update, not an insert. By setting the value of the primary key to 1, it is considered an update. Ninja Database Pro will automatically do an auto increment primary key. Don't set the primary key.NinjaDbPro db = new NinjaDbPro("TabletDir", "TabletDB");
db.OpenDatabase();Person person = new Person();person.Name = "Damien";
db.Save(person);