private void SetUpConnection() { var path = Path.Combine(ApplicationData.Current.LocalFolder.Path, "sqlite.db"); var plat = new SQLitePlatformWinRT(); var connectionFactory = new Func<SQLiteConnectionWithLock>( () => new SQLiteConnectionWithLock(plat, new SQLiteConnectionString(path, false))); _asyncConnection = new SQLiteAsyncConnection(connectionFactory); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); platform = new SQLitePlatformWinRT(); iocContainer = new UnityContainer(); DependencyResolver.RegisterTypes(iocContainer); this.Suspending += this.OnSuspending; }
public SQLiteAsyncConnection GetConnection() { const string sqliteFilename = "Conferences.db3"; var path = Path.Combine(ApplicationData.Current.LocalFolder.Path, sqliteFilename); var platform = new SQLitePlatformWinRT(); var connectionWithLock = new SQLiteConnectionWithLock( platform, new SQLiteConnectionString(path, true)); var connection = new SQLiteAsyncConnection(() => connectionWithLock); return connection; }
public async Task<ConnectionInfo<SQLiteAsyncConnection>> GetConnection() { ConnectionInfo<SQLiteAsyncConnection> connectionInfo = new ConnectionInfo<SQLiteAsyncConnection>(); connectionInfo.IsInitializedDbStructure = true; var sqliteFilename = XamarinSocialApp.UI.Common.Implementations.Constants.Constants.Configuration.csLocalDbFileName; string path = Path.Combine(ApplicationData.Current.LocalFolder.Path, sqliteFilename); if (!await FileExists(path)) { connectionInfo.IsInitializedDbStructure = false; } var plat = new SQLitePlatformWinRT(); var connectionFactory = new Func<SQLiteConnectionWithLock>(() => new SQLiteConnectionWithLock(plat, new SQLiteConnectionString(path, storeDateTimeAsTicks: false))); var asyncConnection = new SQLiteAsyncConnection(connectionFactory); connectionInfo.Connection = asyncConnection; return connectionInfo; }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += this.OnSuspending; databaseName = "FinanceManager.sqlite"; databasePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, databaseName); platform = new SQLitePlatformWinRT(); container = UnityConfig.Container; if (!DatabaseExists(databaseName).Result) { _dataInitService = container.Resolve<IDataInitService>(); _dataInitService.Initialize(); } _currencyRateService = container.Resolve<ICurrencyRatesService>(); _dataInitService = container.Resolve<IDataInitService>(); _dataInitService.CheckReportingPeriods(); _currencyRateService.UpdateExchangeRates(); }
public Database() { SqLitePlatform = new SQLitePlatformWinRT(); }