how can I create multiple tables using entity classes
public class Info
{
public string firstName { get; set; }
public string lastName { get; set; }
public string imageUrl { get; set; }
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public DetailInfo objDetailInfo{ get; set; }
}
public class DetailInfo
{
public string phoneno { get; set; }
public string address { get; set; }
}
I am using the below code
public void createtable()
{
SQLite.SQLiteConnection db= new SQLite.SQLiteConnection(dbPath);
db.CreateTable<Info>();
var data = new Info() { Id = "1", firstName = "Rehan", imageUrl = "safsdfsdf", lastName = "Parvez", objsty = new objDetailInfo{ address = "Nagpur", phoneno = "902136" } };
db.Insert(data);
}
while Executing db.CreateTable<Info>()
it is giving me an Error
I am answer my question myself because I think It will help to my other friends Use Ignore Keyword
public class Info
{
public string firstName { get; set; }
public string lastName { get; set; }
public string imageUrl { get; set; }
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[Ignore]
public DetailInfo objDetailInfo{ get; set; }
}
public class DetailInfo
{
public string phoneno { get; set; }
public string address { get; set; }
}
public void createtable()
{
SQLite.SQLiteConnection db= new SQLite.SQLiteConnection(dbPath);
db.CreateTable<Info>();
db.CreateTable<DetailInfo>();
}