public class Person { [PrimaryKey, AutoIncrement] public int ID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public override string ToString() { return string.Format("[Person: ID={0}, FirstName={1}, LastName={2}]", ID, FirstName, LastName); } }
string dbPath = Path.Combine ( Environment.GetFolderPath (Environment.SpecialFolder.Personal), "database.db3");
using SQLite;
var db = new SQLiteConnection (dbPath);
db.CreateTable<Stock> ();
db.Insert (newStock); // after creating the newStock object
var stock = db.Get<Stock>(5); // primary key id of 5 var stockList = db.Table<Stock>();
References :
https://developer.xamarin.com/recipes/android/data/databases/sqlite/
https://developer.xamarin.com/guides/cross-platform/application_fundamentals/data/part_2_configuration/
https://developer.xamarin.com/guides/cross-platform/application_fundamentals/data/part_3_using_sqlite_orm/