Skip to content

Instantly share code, notes, and snippets.

@benhysell
Created June 28, 2014 18:41
Show Gist options
  • Save benhysell/c408d3d106123cae5f05 to your computer and use it in GitHub Desktop.
Save benhysell/c408d3d106123cae5f05 to your computer and use it in GitHub Desktop.
Building Sql Object MvvmCross
/// <summary>
/// Creates the app.
/// </summary>
/// <returns>An instance of IMvxApplication.</returns>
protected override IMvxApplication CreateApp()
{
var connectionParameters = new SQLiteConnectionString(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "database.db"), false);
var sqliteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformAndroid());
var connection = new SQLiteAsyncConnection(() => sqliteConnectionPool.GetConnection(connectionParameters));
Mvx.RegisterSingleton<SQLiteAsyncConnection>(connection);
return new Core.App();
}
/// <summary>
/// Creates the app.
/// </summary>
/// <returns>An instance of IMvxApplication</returns>
protected override IMvxApplication CreateApp()
{
var connectionParameters = new SQLiteConnectionString(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "database.db"), false);
var sqliteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformIOS());
var connection = new SQLiteAsyncConnection(() => sqliteConnectionPool.GetConnection(connectionParameters));
Mvx.RegisterSingleton<SQLiteAsyncConnection>(connection);
return new Core.App();
}
protected override IMvxApplication CreateApp()
{
var connectionParameters = new SQLiteConnectionString(Path.Combine(ApplicationData.Current.LocalFolder.Path, "database.db"), false);
var sqliteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformWP8());
var connection = new SQLiteAsyncConnection(() => sqliteConnectionPool.GetConnection(connectionParameters));
Mvx.RegisterSingleton<SQLiteAsyncConnection>(connection);
return new Core.App();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment