当前位置: 首页>>代码示例>>C#>>正文


C# SQLiteAsyncConnection.CreateTableAsync方法代码示例

本文整理汇总了C#中SQLiteAsyncConnection.CreateTableAsync方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteAsyncConnection.CreateTableAsync方法的具体用法?C# SQLiteAsyncConnection.CreateTableAsync怎么用?C# SQLiteAsyncConnection.CreateTableAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLiteAsyncConnection的用法示例。


在下文中一共展示了SQLiteAsyncConnection.CreateTableAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeDataStore

		public async Task InitializeDataStore ()
		{
			_isInitialized = true;

			// Get the platform-specific database info
			IPlatform dataPlatform = DependencyService.Get<IPlatform> ();

			// Create the connection
			_sqliteConn = new SQLiteAsyncConnection (() => new SQLiteConnectionWithLock (dataPlatform.OSPlatform,
				new SQLiteConnectionString (dataPlatform.DatabasePath, true)));

			// Create the tables
			await _sqliteConn.CreateTableAsync<Cheese> ().ConfigureAwait (false);
			await _sqliteConn.CreateTableAsync<Rating> ().ConfigureAwait (false);
		}
开发者ID:codemillmatt,项目名称:DevDays,代码行数:15,代码来源:LocalCheeseDataService.cs

示例2: Init

        public async void Init()
        {
            var connectionFactory = Mvx.Resolve<IMvxSqliteConnectionFactory>();
            _connection = connectionFactory.GetAsyncConnection("GastoCertoBD");

            await _connection.CreateTableAsync<PrevisaoGasto>();
        }
开发者ID:CrazyTechLabsHackathonXamarinBSB,项目名称:gastocerto,代码行数:7,代码来源:PrevisaoGastoRepositorio.cs

示例3: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            var connFactory = new Func<SQLiteConnectionWithLock>(() =>
                new SQLiteConnectionWithLock(
                    new SQLitePlatformWin32(),
                    new SQLiteConnectionString("requests.db", false)));

            var sqlite = new SQLiteAsyncConnection(connFactory);
            var sqliteWrapper = new SQLiteAsyncConnectionImpl(sqlite);

            sqlite.CreateTableAsync<HttpRequest>().ContinueWith(_ =>
            {
                var requestHistory = new RequestHistory(sqliteWrapper);

                var historyViewModel = new HistoryViewModel(requestHistory);
                var historyView = new HistoryView(historyViewModel);
                Grid.SetColumn(historyView, 0);
                rootGrid.Children.Add(historyView);

                var requestViewModel = new RequestViewModel(requestHistory, historyViewModel.SelectedRequestObservable);
                var requestView = new RequestView(requestViewModel);
                Grid.SetColumn(requestView, 1);
                rootGrid.Children.Add(requestView);

            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
开发者ID:georgebearden,项目名称:Peticion,代码行数:28,代码来源:MainWindow.xaml.cs

示例4: CreateTablesAsync

        /// <summary>
        /// Creates the database tables.
        /// </summary>
        /// <param name="asyncDbConnection">The asynchronous database connection.</param>
        /// <remarks>
        /// This will insert the initial version entry.
        /// </remarks>
        public static async Task CreateTablesAsync(SQLiteAsyncConnection asyncDbConnection)
        {
            await asyncDbConnection.CreateTableAsync<DatabaseVersion>().ConfigureAwait(false);

            // sets the version to -1 (we haven't built the database yet!)
            await asyncDbConnection.InsertAsync(new DatabaseVersion()).ConfigureAwait(false);
        }
开发者ID:Luminoth,项目名称:BackpackPlanner,代码行数:14,代码来源:DatabaseVersion.cs

示例5: CreateTablesAsync

        private static async Task CreateTablesAsync(SQLiteAsyncConnection asyncDbConnection)
        {
            await asyncDbConnection.CreateTableAsync<GearCollection>().ConfigureAwait(false);

            await GearCollectionGearSystem.CreateTablesAsync(asyncDbConnection).ConfigureAwait(false);
            await GearCollectionGearItem.CreateTablesAsync(asyncDbConnection).ConfigureAwait(false);
        }
开发者ID:Luminoth,项目名称:BackpackPlanner,代码行数:7,代码来源:GearCollection.cs

示例6: btnBulkInsert_Click

        private async void btnBulkInsert_Click(object sender, RoutedEventArgs e)
        {
            var Dbpath = await KnownFolders.DocumentsLibrary.CreateFolderAsync("DBFile", CreationCollisionOption.OpenIfExists);
            connection = new SQLiteAsyncConnection(string.Format("{0}\\{1}", Dbpath.Path, "Sqlitedb.db"));

            ////Create table
            connection.CreateTableAsync<User>();

            var listUser = new List<User>();
            listUser.Add(new User() { UserID = Guid.NewGuid(), DOB = DateTime.Now, Name = "senthil" });
            listUser.Add(new User() { UserID = Guid.NewGuid(), DOB = DateTime.Now, Name = "arun" });
            listUser.Add(new User() { UserID = Guid.NewGuid(), DOB = DateTime.Now, Name = "somu" });

            ////Bulk insert patient data
            connection.BulkInsert<User>(listUser);
            int i = 0;
            foreach (var item in listUser)
            {
                item.Name = item.Name + i.ToString();
                i++;
            }

            ///connection = new SQLiteAsyncConnection(string.Format("{0}\\{1}", Dbpath.Path, "Sqlitedb.db"));
            ////Bulk update patient data
            connection.BulkUpdate<User>(listUser);

            ////Bulk delete patient data
            connection.BulkDelete<User>(listUser);

        }
开发者ID:em-z,项目名称:Docs,代码行数:30,代码来源:MainPage.xaml.cs

示例7: UnicodePathsAsync

        public void UnicodePathsAsync()
        {
            var path = Path.GetTempFileName() + UnicodeText;

            var db = new SQLiteAsyncConnection(path, true);
            db.CreateTableAsync<OrderLine>().Wait();

            Assert.That(new FileInfo(path).Length, Is.GreaterThan(0), path);
        }
开发者ID:Banane9,项目名称:sqlite-net,代码行数:9,代码来源:OpenTests.cs

示例8: PrepareDb

        private void PrepareDb()
        {
            SQLiteAsyncConnection connection = new SQLiteAsyncConnection(Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "TestDb.sqlite"));

            connection.DropTableAsync<Product>();
            connection.CreateTableAsync<Product>();

            connection.InsertAsync(new Product { Name = "Product 1", Serial = "123456" });

        }
开发者ID:piccoloaiutante,项目名称:WP8TestingExample,代码行数:10,代码来源:DbServiceFixture.cs

示例9: UnicodePathsAsync

        public void UnicodePathsAsync()
        {
            string path = Path.GetTempFileName() + UnicodeText;

            var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformWin32());
            var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(new SQLiteConnectionString(path, true)));
            db.CreateTableAsync<OrderLine>().Wait();

            Assert.That(new FileInfo(path).Length, Is.GreaterThan(0), path);
        }
开发者ID:giacatlaoboi,项目名称:SQLite.Net-PCL,代码行数:10,代码来源:OpenTests.cs

示例10: UnicodePathsAsync

        public async Task UnicodePathsAsync()
        {
            var fileName = TestPath.CreateDefaultTempFilename() + UnicodeText + ".db";
            var filePath = TestPath.CreateTemporaryDatabase(fileName);

            var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), new SQLiteConnectionString(filePath, true)));
            await db.CreateTableAsync<OrderLine>();

            Assert.That(filePath.Length, Is.GreaterThan(0), fileName);
        }
开发者ID:Reza1024,项目名称:SQLite.Net-PCL,代码行数:10,代码来源:OpenTests.cs

示例11: TestAsyncDateTime

        private async Task TestAsyncDateTime(SQLiteAsyncConnection db)
        {
            await db.CreateTableAsync<TestDb>();

            var val1 = new TestDb
            {
                Time = new TimeSpan(1000),
            };
            await db.InsertAsync(val1);
            TestDb val2 = await db.GetAsync<TestDb>(val1.Id);
            Assert.AreEqual(val1.Time, val2.Time);
        }
开发者ID:NateRickard,项目名称:SQLite.Net-PCL,代码行数:12,代码来源:TimeSpanTest.cs

示例12: SQLiteLoggerAdapter

        public SQLiteLoggerAdapter(LoggerSettings LoggerSettings_,SQLiteAsyncConnection SQLiteLogConnection_)
        {
            LoggerSettings = LoggerSettings_;
            SQLiteLogConnection = SQLiteLogConnection_;

            var t = SQLiteLogConnection.CreateTableAsync<LogMessage>().Result;

            if (LoggerSettings.DeleteMessagesOnStart)
            {
                SQLiteLogConnection.DeleteAllAsync<LogMessage>();
            }
            
        }
开发者ID:vlkam,项目名称:OpenLearningPlayer,代码行数:13,代码来源:SQLiteLoggerAdapter.cs

示例13: PersonRepository

		public PersonRepository(ISQLitePlatform sqlitePlatform, string dbPath)
		{
			//initialize a new SQLiteConnection 
			if (dbConn == null)
			{
				var connectionFunc = new Func<SQLiteConnectionWithLock>(() =>
					new SQLiteConnectionWithLock
					(
						sqlitePlatform,
						new SQLiteConnectionString(dbPath, storeDateTimeAsTicks: false)
					));

				dbConn = new SQLiteAsyncConnection(connectionFunc);
				dbConn.CreateTableAsync<Person>();
			}
		}
开发者ID:karlaniki,项目名称:DbPublish,代码行数:16,代码来源:PersonRepository.cs

示例14: TestAsyncDateTime

        void TestAsyncDateTime(SQLiteAsyncConnection db)
        {
            db.CreateTableAsync<TestObj> ().Wait ();

            TestObj o, o2;

            //
            // Ticks
            //
            o = new TestObj {
                ModifiedTime = new DateTime (2012, 1, 14, 3, 2, 1, 234),
            };
            db.InsertAsync (o).Wait ();
            o2 = db.GetAsync<TestObj> (o.Id).Result;
            Assert.AreEqual (o.ModifiedTime, o2.ModifiedTime);
        }
开发者ID:FatJohn,项目名称:sqlite-net,代码行数:16,代码来源:DateTimeTest.cs

示例15: TestAsyncDateTime

        private async Task TestAsyncDateTime(SQLiteAsyncConnection db)
        {
            await db.CreateTableAsync<TestObj>();

            TestObj o, o2;

            //
            // Ticks
            //
            o = new TestObj
            {
                ModifiedTime = new DateTime(2012, 1, 14, 3, 2, 1),
            };
            await db.InsertAsync(o);
            o2 = await db.GetAsync<TestObj>(o.Id);
            Assert.AreEqual(o.ModifiedTime, o2.ModifiedTime);
        }
开发者ID:happynik,项目名称:SQLite.Net-PCL,代码行数:17,代码来源:DateTimeTest.cs


注:本文中的SQLiteAsyncConnection.CreateTableAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。