I want to create a table using sqlite.net with a Primary Key auto-number.
I know how to do it the command object but want it done using this framework. I thought all I had to do was define the model with the correct attrinbutes?
This is my model:
[Table("Customer")]
public sealed class Customer
{
public Customer() { }
[PrimaryKey]
[AutoIncrement]
public int CustomerId { get; set; }
public bool Exists { get; set; }
public string ErrorMessage { get; set; }
public string CustomerRef { get; set; }
public string SName { get; set; }
public string FName { get; set; }
public string ContactNo { get; set; }
public string Email { get; set; }
public string DOE { get; set; }
public string Add1 { get; set; }
public string Add2 { get; set; }
public string Add3 { get; set; }
public string Town { get; set; }
public string County { get; set; }
public string PCode { get; set; }
public string Country { get; set; }
public string CustomerHeader { get; set; }
public string AddressHeader { get; set; }
}
This is my creator:
DB.GetConnection();
DB.Connector.CreateTable<Model.Customer>();
It creates the table OK but no PK or auto-number has been defined..?
Aucun commentaire:
Enregistrer un commentaire