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


C# SQLiteConnection.CreateTable方法代码示例

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


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

示例1: MapServiceSQLite

        public MapServiceSQLite()
        {
            using (SQLiteConnection connection = new SQLiteConnection(SQLiteConfiguration.ConnectionString))
            {
                connection.CreateTable<MapModel>();
                if (connection.ExecuteScalar<int>("SELECT COUNT(*) FROM Maps") == 0)
                    connection.RunInTransaction(() =>
                    {
                        connection.Insert(new MapModel(Guid.NewGuid(), "Default Map", @"ms-appx:///MetroExplorer.Components.Maps/DesignAssets/MapBackground.bmp"));
                    });

                connection.CreateTable<MapLocationModel>();
                connection.CreateTable<MapLocationFolderModel>();
            }
        }
开发者ID:CasaTeam,项目名称:MetroExplorer,代码行数:15,代码来源:MapServiceSQLite.cs

示例2: BookKeeperManager

		//constructor
		private BookKeeperManager ()
		{
			string dbPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
			db = new SQLiteConnection ( dbPath + @"\database.db");

			try{
				db.Table<Entry>().Count();
			} catch(SQLiteException e){
				db.CreateTable<Entry> ();
			}

			try{
				db.Table<TaxRate>().Count();
			} catch(SQLiteException e){
				db.CreateTable<TaxRate> ();
				db.Insert (new TaxRate(){ Tax = 6.0});
				db.Insert (new TaxRate(){ Tax = 12.0});
				db.Insert (new TaxRate(){ Tax = 25.0});
			}

			try{
				db.Table<Account>().Count();
			} catch(SQLiteException e){
				db.CreateTable<Account> ();
				db.Insert (new Account(){ Name = "Försäljning inom Sverige", Number = 3000});
				db.Insert (new Account(){ Name = "Fakturerade frakter", Number = 3520});
				db.Insert (new Account(){ Name = "Försäljning av övrigt material", Number = 3619});
				db.Insert (new Account(){ Name = "Lokalhyra", Number = 5010});
				db.Insert (new Account(){ Name = "Programvaror", Number = 5420});
				db.Insert (new Account(){ Name = "Energikostnader", Number = 5300});
				db.Insert (new Account(){ Name = "Kassa", Number = 1910});
				db.Insert (new Account(){ Name = "PlusGiro", Number = 1920});
				db.Insert (new Account(){ Name = "Bankcertifikat", Number = 1950});
			}
		}
开发者ID:Hejkitty54,项目名称:XamarinAccounting,代码行数:36,代码来源:BookKeeperManager.cs

示例3: POCDB

 /// <summary>
 /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. 
 /// if the database doesn't exist, it will create the database and all the tables.
 /// </summary>
 /// <param name='path'>
 /// Path.
 /// </param>
 public POCDB()
 {
     database = DependencyService.Get<ISQLite> ().GetConnection ();
     // create the tables
     database.CreateTable<TodoItem>();
     database.CreateTable<UserProfile>();
 }
开发者ID:dhinesh886,项目名称:XamarinPOCRepo,代码行数:14,代码来源:POCDB.cs

示例4: Model

        public Model()
        {
            // prepare model state/data
            m_data = new PersistentModelData ();

            // prepare DB
            //			Log.Debug ("Ruly", "ext sd: " + Android.OS.Environment.ExternalStorageDirectory);
            //			string folder = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
            string folder = Android.OS.Environment.ExternalStorageDirectory + "/ruly/ruly.db";
            Util.EnsureDirectory (System.IO.Path.GetDirectoryName (folder));
            m_db = new SQLiteConnection (folder);
            m_db.CreateTable<TaskData>();
            m_db.CreateTable<TaskHistory>();
            m_db.CreateTable<TaskAlarm> ();

            m_unknown_task = new TaskData () {
                Id = -1,
                Title = "休憩"
            };

            // create ViewModel I/F datasets
            Tasks = new ObservableCollection<TaskData>();
            TaskHistories = new ObservableCollection<CombinedTaskHistory> ();
            RawTaskHistories = new ObservableCollection<CombinedTaskHistory> ();
            UpdateTaskList ();

            // show today task at default
            // this result in call UpdateTaskHistoryList();
            ShowDate = DateTime.Today;
        }
开发者ID:ruly-rudel,项目名称:ruly,代码行数:30,代码来源:Model.cs

示例5: TodoDatabase

 /// <summary>
 /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. 
 /// if the database doesn't exist, it will create the database and all the tables.
 /// </summary>
 /// <param name='path'>
 /// Path.
 /// </param>
 public TodoDatabase()
 {
     database = DependencyService.Get<ISQLite>().GetConnection();
     // create the tables
     database.CreateTable<TODOItem>();
     database.CreateTable<EventItem>();
 }
开发者ID:djoker07,项目名称:c_sharp,代码行数:14,代码来源:TodoDatabase.cs

示例6: Connect

        public void Connect()
        {
            sqlConnection = new SQLiteConnection(DB_PATH);

            if (!ApplicationData.Current.LocalSettings.Values.ContainsKey(DB_VERSION_KEY))
            {
                ApplicationData.Current.LocalSettings.Values.Add(DB_VERSION_KEY, 0);
            }

            int currentDatabaseVersion = DebugHelper.CastAndAssert<int>(ApplicationData.Current.LocalSettings.Values[DB_VERSION_KEY]);

            if (currentDatabaseVersion < 1)
            {
                sqlConnection.CreateTable<ArtistTable>();
                sqlConnection.CreateTable<AlbumTable>();
                sqlConnection.CreateTable<SongTable>();
                sqlConnection.CreateTable<PlayQueueEntryTable>();
                sqlConnection.CreateTable<PlaylistTable>();
                sqlConnection.CreateTable<PlaylistEntryTable>();
                sqlConnection.CreateTable<HistoryTable>();
                sqlConnection.CreateTable<MixTable>();
                sqlConnection.CreateTable<MixEntryTable>();
                sqlConnection.CreateTable<BackgroundTable>();
            }

            if (currentDatabaseVersion < DB_VERSION)
            {
                ApplicationData.Current.LocalSettings.Values[DB_VERSION_KEY] = DB_VERSION;
            }
        }
开发者ID:jevonsflash,项目名称:ProjectMato,代码行数:30,代码来源:DatabaseManager.cs

示例7: MainModel

        public MainModel()
        {
            // This forces the instantiation
            mDictionarySearcher = ServiceContainer.Resolve<SearchModel> ();
            mSuggestionModel = ServiceContainer.Resolve<SuggestionModel> ();
            mPlaySoundModel = ServiceContainer.Resolve<PlaySoundModel> ();

            mDictionarySearcher.SearchCompleted += OnSearchCompleted;

            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            mDatabasePath = Path.Combine(documentsPath, "..", "Library", "db_sqlite-net.db");

            bool isFirstLoad = false;

            using (var conn = new SQLite.SQLiteConnection(mDatabasePath))
            {
                // https://github.com/praeclarum/sqlite-net/wiki
                // In general, it will execute an automatic migration
                conn.CreateTable<WordModel>();
                conn.CreateTable<WaveModel>();

                InitialRefresh(conn);
                LoadNextWord(conn);
                RefreshWordsList(conn);

                isFirstLoad = conn.Table<WordModel>().Count() == 0;
            }

            if (isFirstLoad)
            {
                AddWord("Thanks");
                AddWord("For");
                AddWord("Downloading");
            }
        }
开发者ID:vmendi,项目名称:ListenAndRepeat,代码行数:35,代码来源:MainModel.cs

示例8: Login_Loaded

 async void Login_Loaded()
 {
     try
     {
         await ApplicationData.Current.LocalFolder.CreateFileAsync("Shopping.db3");
         var path = Path.Combine(ApplicationData.Current.LocalFolder.Path, "Shopping.db3");
         using (var db = new SQLite.SQLiteConnection(path))
         {
             // Create the tables if they don't exist
             db.CreateTable<ShopLists>();
             db.CreateTable<ShopAdmins>();
             db.Commit();
             db.Dispose();
             db.Close();
         }
         ServiceReference1.SoapServiceSoapClient sc=new SoapServiceSoapClient();
         sc.AllCouponsCompleted += (a, b) => MessageBox.Show(b.Result);
         sc.AllCouponsAsync("hacking");
       
     }
     catch (Exception ex)
     {
         FaultHandling(ex.StackTrace);
     }
 }
开发者ID:prabaprakash,项目名称:Visual-Studio-2013,代码行数:25,代码来源:Login.xaml.cs

示例9: ItemDetailsDatabase

 /// <summary>
 /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. 
 /// if the database doesn't exist, it will create the database and all the tables.
 /// </summary>
 /// <param name='path'>
 /// Path.
 /// </param>
 public ItemDetailsDatabase()
 {
     database = DependencyService.Get<ISQLite> ().GetConnection ();
     // create the tables
     database.CreateTable<ItemDetails>();
     database.CreateTable<ShoppingList>();
     database.CreateTable<ShoppingCartItem>();
 }
开发者ID:jackphilippi,项目名称:SmartCart,代码行数:15,代码来源:ItemDetailsDatabase.cs

示例10: TextSecurePreKeyStore

 public TextSecurePreKeyStore(SQLiteConnection conn)
 {
     this.conn = conn;
     conn.CreateTable<PreKeyRecordI>();
     conn.CreateTable<PreKeyIndex>();
     conn.CreateTable<SignedPreKeyRecordI>();
     conn.CreateTable<SignedPreKeyIndex>();
 }
开发者ID:smndtrl,项目名称:Signal-UWP,代码行数:8,代码来源:TextSecurePreKeyStore.cs

示例11: ArticoliDatabase

		/// <summary>
		/// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. 
		/// if the database doesn't exist, it will create the database and all the tables.
		/// </summary>
		/// <param name='path'>
		/// Path.
		/// </param>
		public ArticoliDatabase()
		{
			var db = DependencyService.Get<IDatabase> ();

			database = db.GetConnection ();
			// create the tables
			database.CreateTable<Articolo>();
			database.CreateTable<Categoria> ();
		}
开发者ID:maurocavallin,项目名称:CorsoXamarinGiugno2015,代码行数:16,代码来源:Database.cs

示例12: InventoryDatabase

 /// <summary>
 /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. 
 /// if the database doesn't exist, it will create the database and all the tables.
 /// </summary>
 /// <param name='path'>
 /// Path.
 /// </param>
 public InventoryDatabase()
 {
     database = new SQLiteConnection(DatabasePath);
     // Create the tables
     database.CreateTable<InventoryItem>();
     database.CreateTable<InventoryMedia>();
     database.CreateTable<ActivityLog>();
     database.CreateTable<ListData>();
 }
开发者ID:wspeerbrecker,项目名称:RCInventory,代码行数:16,代码来源:InventoryDatabase.cs

示例13: BookService

 private BookService()
 {
     dbPath = Path.Combine(Path.Combine(ApplicationData.Current.LocalFolder.Path, "jadeface.sqlite"));
     dbConn = new SQLiteConnection(dbPath);
     dbConn.CreateTable<BookListItem>();
     dbConn.CreateTable<ReadingRecord>();
     dbConn.CreateTable<ReadingPlan>();
     dbConn.CreateTable<ReadingNote>();
 }
开发者ID:binarywizard,项目名称:WP8Project,代码行数:9,代码来源:BookService.cs

示例14: CreateTable

 //creating tables in database
 public void CreateTable()
 {
     var path = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
     dbConn = new SQLiteConnection (System.IO.Path.Combine (path, DB_NAME));
     dbConn.CreateTable<VehicleInfo> ();
     dbConn.CreateTable<TripInfo> ();
     dbConn.CreateTable<ExpenseInfo> ();
     dbConn.CreateTable<SettingsInfo> ();
 }
开发者ID:heb264,项目名称:ITC539_VEL,代码行数:10,代码来源:DBManager.cs

示例15: EventRepository

 public EventRepository()
 {
     string dbPath = Path.Combine (
         Environment.GetFolderPath (Environment.SpecialFolder.Personal),
         "signin.db3");
     db = new SQLiteConnection (dbPath);
     db.CreateTable<ProjectEvent> ();
     db.CreateTable<EventPerson> ();
 }
开发者ID:pallu,项目名称:SignIn,代码行数:9,代码来源:EventRepository.cs


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