static string TABLE_NAME = "GenerateConfig"; //table name /// <summary> /// Insert /// </summary> /// <param name="model"></param> /// <returns></returns> public int Insert(GenerateConfig model) { // Open database (or create if not exits) using (var db = new LiteDatabase(LocalConfig.SettingDataFileName)) { // Get DbConnection collection var col = db.GetCollection <GenerateConfig>(TABLE_NAME); var value = col.Insert(model); return(value.AsInt32); } }
/// <summary> /// 刷新数据 /// </summary> public void Refresh() { var configData = dalObj.FindAll(); if (configData.Any() == false) { data = new GenerateConfig(); dalObj.Insert(data); return; } data = configData.First(); }
/// <summary> /// Update /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Update(GenerateConfig model) { return(LiteDBHelper <GenerateConfig> .Update(LocalConfig.SettingDataFileName, model, TABLE_NAME)); }