Reputation: 4422
I guess this is to do with my lack of understanding of how Vici CS ORM for MonoTouch works. When using Vici CS for Monotouch, instantiating a DB-mapped object takes long time (several tens of seconds) when the primary key is not set to INTEGER AUTOINCREMENT. When the PK is INTEGER AUTOINCREMENT, the execution is smooth.
My DB-mapped class looks like this:
[MapTo("Employees")]
public class Employee : CSObject<Employee, int>
{
public Employee () { }
public int EmployeeId { get { return (int)GetField ("EmployeeId "); } }
public string Name{ get { return (string)GetField ("Name"); } set { SetField ("Name",value); } }
public string Address{ get { return (string)GetField ("Address"); } set { SetField ("Address",value); } }
}
And the database creation script:
CREATE TABLE Employees (EmployeeId INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT, Address TEXT)");
Removing AUTOINCREMENT keyword in table creation script slows down Employee object instantiation. Not removing it works fine.
Is there recommended way avoid that constraint? For example, is it possible to have a TEXT field as the primary key which can then contain say a guid?
Upvotes: 2
Views: 190