本文整理汇总了C#中SQLiteConnection.CreateTable方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteConnection.CreateTable方法的具体用法?C# SQLiteConnection.CreateTable怎么用?C# SQLiteConnection.CreateTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLiteConnection
的用法示例。
在下文中一共展示了SQLiteConnection.CreateTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Proceed_Click
private void Proceed_Click(object sender, RoutedEventArgs e)
{
Model.Userdata userData = new Model.Userdata();
userData.addData(name.Text, (int)AgeList.SelectedItem, 0);
// Create a Database.
// Add to database.
try
{
var path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "App.db");
var db = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT() ,path);
db.CreateTable<Model.Userdata>();
db.CreateTable<Model.Subject>();
db.Insert(userData);
this.Frame.Navigate(typeof(World2));
}
catch (Exception)
{
throw;
}
// redirecting to
}
示例2: ECOdatabase
public ECOdatabase ()
{
database = DependencyService.Get<ISqlite> ().GetConnection ();
// database.DeleteAll<CartItem> ();
//Create a CartItem table if there is no such table
if (database.TableMappings.All(t => t.MappedType.Name != typeof(CartItem).Name)) {
//Create cartitem table
database.CreateTable<CartItem> ();
database.Commit ();
}
if (database.TableMappings.All(t => t.MappedType.Name != typeof(BuyList).Name)) {
//Create cartitem table
database.CreateTable<BuyList> ();
database.Commit ();
}
if (database.TableMappings.All(t => t.MappedType.Name != typeof(WoolworthsItem).Name)) {
//Create cartitem table
database.CreateTable<WoolworthsItem> ();
database.Commit ();
}
// database.DeleteAll<BuyList>();
if (GetWoolWorthsItemAll ().Count == 0) {
WoolworthsItem item1 = new WoolworthsItem ("50375264", "Kleenex Tissues", 2.50);
InsertItemToWoolWorthsItem (item1);
}
}
示例3: UserService
public UserService(ISlackRestClient restClient, ISQLite sqlite)
{
_restClient = restClient;
_database = sqlite.GetConnection();
_database.CreateTable<User>();
_database.CreateTable<UserProfile>();
}
示例4: FlashCardManager
public FlashCardManager(ISQLiteConnection connection, IMvxMessenger messenger)
{
_messenger = messenger;
_connection = connection.connection;
_connection.CreateTable<FlashCardSet>();
_connection.CreateTable<FlashCard>();
}
示例5: ImageRepository
public ImageRepository()
{
connection = new SQLiteDroid();
_db = connection.GetConnection();//データベース接続
_db.CreateTable<TagItem>();//テーブル作成
_db.CreateTable<ImageTag>();//テーブル作成
_db.CreateTable<ImageItem>();//テーブル作成
}
示例6: EvolveDatabase
/// <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 EvolveDatabase(SQLiteConnection conn)
{
database = conn;
// create the tables
database.CreateTable<Speaker>();
database.CreateTable<Session>();
database.CreateTable<SessionSpeaker>();
database.CreateTable<Favorite>();
}
示例7: Sqlite
public Sqlite()
{
path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "TripPlanner.sqlite");
conn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path);
conn.CreateTable<Plans>();
conn.CreateTable<TripPlanner.Classes.DayEvents>();
conn.CreateTable<Days>();
Debug.WriteLine(path);
}
示例8: CreateDb
private static void CreateDb()
{
using (SQLiteConnection conn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), DbPath))
{
conn.CreateTable<RepZoneSetting>();
conn.CreateTable<Address>();
conn.CreateTable<Brand>();
conn.CreateTable<Contact>();
}
}
示例9: CreateTables
private void CreateTables()
{
using (var conn = new SQLiteConnection(_platform, _dbPath))
{
conn.CreateTable<Image>();
conn.CreateTable<Position>();
conn.CreateTable<Station>();
conn.CreateTable<FavoriteTrainPath>();
conn.Close();
}
}
示例10: Invoke
public void Invoke(ServerMessage message, IIrcClient ircClient, ILogger logger)
{
if (message.Command.Equals("376") && !_isInitialized) //We use this to initialize the plugin. This should only happen once.
{
_ircClient = ircClient;
_logger = logger;
//Subscribe to when the stream startes/ends events
_ircClient.TwitchService.OnStreamOnline += TwitchService_OnStreamOnline;
_ircClient.TwitchService.OnStreamOffline += TwitchService_OnStreamOffline;
_timer.AutoReset = true;
_timer.Interval = 60000;
_timer.Elapsed += _timer_Elapsed;
_timer.Enabled = true;
_dataFolder = PluginHelper.GetPluginDataFolder(this);
_database = new SQLiteConnection(new SQLitePlatformWin32(), Path.Combine(_dataFolder, "CurrencyPlugin.db"));
_database.CreateTable<CurrencyUserModel>();
//This is for debugging
//_watchedChannelsList.Add("#unseriouspid");
//_onlineChannelsList.Add("#unseriouspid");
_logger.Write($"{GetType().Name} Initialized.");
_isInitialized = true;
}
else if (message.Command.Equals("PRIVMSG") &&
_isInitialized &&
_watchedChannelsList.Contains(message.GetChannelName()))
{
var userCommand = message.Trailing.Split(' ')[0].ToLower().TrimStart();
var nickName = message.GetSender();
var channelName = message.GetChannelName();
switch (userCommand)
{
case "!points":
if (IsUserCommandOnCooldown(userCommand, nickName, channelName)) return;
DisplayPoints(nickName, channelName);
CooldownUserCommand(userCommand, nickName, channelName);
break;
case "!gamble":
if (IsUserCommandOnCooldown(userCommand, nickName, channelName)) return;
DoGamble(message);
CooldownUserCommand(userCommand, nickName, channelName);
break;
case "!bonus":
DoAddBonus(message);
break;
case "!bonusall":
DoAddBonusAll(message);
break;
}
}
}
示例11: GetDatabse
private static SQLiteConnection GetDatabse()
{
var connection = new SQLiteConnection(new SQLitePlatformWinRT(), DbPath);
// 创建 Person 模型对应的表,如果已存在,则忽略该操作。
connection.CreateTable<PostDetail>();
return connection;
}
示例12: GetDbxsqConnection
public static SQLiteConnection GetDbxsqConnection()
{
var conn = new SQLiteConnection(new SQLitePlatformWinRT(), DBPath);
conn.CreateTable<XYXS>();
return conn;
}
示例13: LocalDataService
public LocalDataService(IDbConnectionService dbConnectionService)
{
this.dbConnectionService = dbConnectionService;
connection = dbConnectionService.Connection;
connection.CreateTable<Person>();
}
示例14: ByteArrayWhere
public void ByteArrayWhere()
{
//Byte Arrays for comparisson
ByteArrayClass[] byteArrays = new ByteArrayClass[] {
new ByteArrayClass() { bytes = new byte[] { 1, 2, 3, 4, 250, 252, 253, 254, 255 } }, //Range check
new ByteArrayClass() { bytes = new byte[] { 0 } }, //null bytes need to be handled correctly
new ByteArrayClass() { bytes = new byte[] { 0, 0 } },
new ByteArrayClass() { bytes = new byte[] { 0, 1, 0 } },
new ByteArrayClass() { bytes = new byte[] { 1, 0, 1 } },
new ByteArrayClass() { bytes = new byte[] { } }, //Empty byte array should stay empty (and not become null)
new ByteArrayClass() { bytes = null } //Null should be supported
};
SQLiteConnection database = new SQLiteConnection(TestPath.GetTempFileName());
database.CreateTable<ByteArrayClass>();
byte[] criterion = new byte[] { 1, 0, 1 };
//Insert all of the ByteArrayClass
int id = 0;
foreach (ByteArrayClass b in byteArrays)
{
database.Insert(b);
if (b.bytes != null && criterion.SequenceEqual<byte>(b.bytes))
id = b.ID;
}
Assert.AreNotEqual(0, id, "An ID wasn't set");
//Get it back out
ByteArrayClass fetchedByteArray = database.Table<ByteArrayClass>().Where(x => x.bytes == criterion).First();
Assert.IsNotNull(fetchedByteArray);
//Check they are the same
Assert.AreEqual(id, fetchedByteArray.ID);
}
示例15: CreateTableConnection
private static SQLiteConnection CreateTableConnection()
{
// 创建 News 模型对应的表,如果已存在,则忽略该操作。
var connection = new SQLiteConnection(new SQLitePlatformWinRT(), DataBase.DbPath);
connection.CreateTable<News>();
return connection;
}