本文整理汇总了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>();
}
}
示例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});
}
}
示例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>();
}
示例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;
}
示例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>();
}
示例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;
}
}
示例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");
}
}
示例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);
}
}
示例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>();
}
示例10: TextSecurePreKeyStore
public TextSecurePreKeyStore(SQLiteConnection conn)
{
this.conn = conn;
conn.CreateTable<PreKeyRecordI>();
conn.CreateTable<PreKeyIndex>();
conn.CreateTable<SignedPreKeyRecordI>();
conn.CreateTable<SignedPreKeyIndex>();
}
示例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> ();
}
示例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>();
}
示例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>();
}
示例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> ();
}
示例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> ();
}