public async Task <int> Insert(EngineInfoModel model) { try { if (FreeHanlder.SqliteHandler == null) { throw new NullReferenceException("未初始化SqliteHandler数据库访问程序;"); } model.Id = (int)(await FreeHanlder.SqliteHandler.Insert <EngineInfoModel>() .AppendData(model) .ExecuteIdentityAsync()); return(model.Id); } catch (Exception ex) { throw ex; } }
public async Task <int> Update(EngineInfoModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } try { if (FreeHanlder.SqliteHandler == null) { throw new NullReferenceException("未初始化SqliteHandler数据库访问程序;"); } return(await FreeHanlder.SqliteHandler.Update <EngineInfoModel>() .SetSource(model) .ExecuteAffrowsAsync()); } catch (Exception ex) { throw ex; } }