All the code samples I found so far regarding using a Sqlite database in an iPad/iPhone app use scripts to create the database once the app is deployed.
But is it possible to create a database in monotouch, build the structure, even pre-populate it with data and deploy it along with iPad app?
If so, what is the location of the database, How do I build the Sqlite Connection?
At the moment I use the following:
new SqliteConnection("Data Source=" + DatabasePath);
Where
public static String DatabasePath {
get {
string documents = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
return Path.Combine (documents, "MyDB.db");
}
}
You could pre-build your database, copy it into the app bundle, and (as long as it is read-only) you could access it directly from your app’s bundle whenever you want. If you need write access you could copy your pre-built file to a different directory and then modify it from there.