public SQLiteRepository(ISQLite SQLite)
        {
            if (SQLite == null)
            {
                throw new ArgumentNullException("SQLite");
            }

            _SQLiteConnection = SQLite.GetAsyncConnection();
            _SQLiteConnection.CreateTableAsync <T>().Wait();
        }
        public BaseRepository(ISQLite sqlite, IEventAggregator eventAggregator)
        {
            _connection      = sqlite.GetConnection();
            _asyncConnection = sqlite.GetAsyncConnection();
            _eventAggregator = eventAggregator;

            CreateTableIfNonExistent();

            _eventAggregator.GetEvent <LogoutEvent>().Subscribe(async() => await RemoveAllAsync());
        }
Exemple #3
0
        public DatabaseService(ISQLite sqlite)
        {
            _sqlite = sqlite;

            var connection = _sqlite.GetConnection();

            UpdateDatabase(connection);

            _connection = _sqlite.GetAsyncConnection();
        }
Exemple #4
0
        public async Task OpenAsyncConnection()
        {
            _asyncConnection = _sqlite.GetAsyncConnection();

            try
            {
                await _asyncConnection.Table <T>().CountAsync();
            }
            catch (SQLiteException)
            {
                await _asyncConnection.CreateTableAsync <T>();
            }
        }
Exemple #5
0
 public SQLiteAsyncConnection GetAsyncConnection()
 {
     return(_sqlite.GetAsyncConnection());
 }
 public SQLiteNhanVienStore(ISQLite db)
 {
     _connection = db.GetAsyncConnection();
     _connection.CreateTableAsync <NhanVien>();
 }
Exemple #7
0
 public Repository(ISQLite connectionService)
 {
     _connectionService = connectionService;
     _db = _connectionService.GetAsyncConnection();
     _db.CreateTableAsync <T>();
 }
Exemple #8
0
 public SQLiteHoaDonStore(ISQLite db)
 {
     _connection = db.GetAsyncConnection();
     _connection.CreateTableAsync <HoaDon>();
 }
 public SQLiteFoodStore(ISQLite db)
 {
     _connection = db.GetAsyncConnection();
     _connection.CreateTableAsync <Food>();
 }