本文整理汇总了C#中SQLiteConnection.InsertOrReplace方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteConnection.InsertOrReplace方法的具体用法?C# SQLiteConnection.InsertOrReplace怎么用?C# SQLiteConnection.InsertOrReplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLiteConnection
的用法示例。
在下文中一共展示了SQLiteConnection.InsertOrReplace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StudySettingsService
private int SelectedSetId; // make this a global property
#endregion Fields
#region Constructors
public StudySettingsService(ISQLiteConnection connection)
{
_connection = connection.connection;
_connection.CreateTable<StudySettings>();
if (!(DefaultSettingsExist()))
{
_connection.InsertOrReplace(new StudySettings()
{
Id = 1,
CanShowCharacters = true,
FirstSide = "English",
MaxCardsInStudySet = 10000,
Name = "Default Settings",
SelectedSetId = 0,
ShowSimplified = true,
ShowDefinition = true,
ShowPinyin = true,
ShowTraditional = true
});
}
}
示例2: SaveData
public static void SaveData(List<ModelDB> data, SaveInfo save = null)
{
if (save != null) {
SetCurrentSave(save);
}
var _conn = new SQLiteConnection(Conf.savePath + currentSave.Filename, SQLiteOpenFlags.ReadWrite);
// remember types we already created tables for
var types = new List<Type>();
foreach(ModelDB v in data) {
var type = v.GetType();
if (!types.Contains(type)) {
_conn.CreateTable(v.GetType());
types.Add(type);
}
_conn.InsertOrReplace(v);
}
}