Ejemplo n.º 1
0
        public static async Task InitializeDatabaseAsync()
        {
            var db = CreateConnection();
            CreateTablesResult result = await db.CreateTableAsync <DbRisQueryParameter>();

            result = await db.CreateTableAsync <DbDownloadedDocument>();
        }
Ejemplo n.º 2
0
        public LockDatabase(ILocalFilePathProvider filePathProvider)
        {
            _filePathProvider = filePathProvider;
            var pathToDb = _filePathProvider.GetPathForFile(DefaultDbName);

            _sqLiteConnection   = new SQLiteAsyncConnection(pathToDb);
            _createTablesResult = _sqLiteConnection.CreateTableAsync <Models.LockEntity>().Result;
        }
Ejemplo n.º 3
0
        private async void Init()
        {
            db = DependencyService.Get <ISqliteConnection>().GetConnection();

            CreateTablesResult created = await db.CreateTableAsync <CategoryDataModels>();

            created = await db.CreateTableAsync <ProductDataModels>();

            created = await db.CreateTableAsync <ReviewDetailsDataModel>();
        }
Ejemplo n.º 4
0
        private async Task <bool> CreateTable()
        {
            var conn = new SQLiteAsyncConnection(_dbPath);

            try
            {
                CreateTablesResult rs = await conn.CreateTableAsync <Movie>();

                Log.Debug("CreateTable", "returned " + (rs.Results.ToString()));

                return(true);
            }
            catch (SQLiteException ex)
            {
                Log.Debug("CreateTable", "Exception " + ex.Message);
                return(false);
            }
        }
Ejemplo n.º 5
0
 public Task <CreateTablesResult> CreateTablesAsync(params Type[] types)
 {
     if (types == null)
     {
         throw new ArgumentNullException("types");
     }
     return(Task.Factory.StartNew(() =>
     {
         var result = new CreateTablesResult();
         SQLiteConnectionWithLock conn = GetConnection();
         using (conn.Lock())
         {
             foreach (Type type in types)
             {
                 int aResult = conn.CreateTable(type);
                 result.Results[type] = aResult;
             }
         }
         return result;
     }, CancellationToken.None, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default));
 }
 public Task <CreateTablesResult> CreateTablesAsync(CancellationToken cancellationToken = default(CancellationToken), [NotNull] params Type[] types)
 {
     if (types == null)
     {
         throw new ArgumentNullException("types");
     }
     return(Task.Factory.StartNew(() =>
     {
         var result = new CreateTablesResult();
         var conn = GetConnection();
         using (conn.Lock())
         {
             foreach (var type in types)
             {
                 var aResult = conn.CreateTable(type);
                 result.Results[type] = aResult;
             }
         }
         return result;
     }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default));
 }
Ejemplo n.º 7
0
 public Task <CreateTablesResult> CreateTablesAsync(params Type[] types)
 {
     if (types == null)
     {
         throw new ArgumentNullException("types");
     }
     return(_taskFactory.StartNew(() =>
     {
         var result = new CreateTablesResult();
         SQLiteConnectionWithLock conn = GetConnection();
         using (conn.Lock())
         {
             foreach (Type type in types)
             {
                 int aResult = conn.CreateTable(type);
                 result.Results[type] = aResult;
             }
         }
         return result;
     }));
 }
Ejemplo n.º 8
0
 private async void CreateTableAsync()
 {
     CreateTablesResult SettingTable = await Connection.CreateTableAsync <Setting>();
 }