a237428367

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About a237428367

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  1. so when update or delete a record not need to use entity.Store() or entity.Deallocate() ?
  2. Hi , I have a question when my app running in multithreading mode. So when i select or add or delete or update record. I also must use db.BeginTransaction() and db.CommitTransaction , right ? now my code like this : ---------------------------------------------------------------------------------------- DB = new Database(instanse, true); When delete all record and add new record : ---------------------------------------------------------------------------------------- try { DB.BeginTransaction(); var list = DB.Select<Entity>(p => 1 == 1, true); foreach (var item in list) { _perstOddsCacheDB.DeleteRecord(item); } foreach (var matchID in _Live.Keys) { string[] data = _oddsLive[matchID]; Entity entity = CreateEntity(matchID, data); DB.AddRecord(entity); } DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); } ---------------------------------------------------------------------------------------- When Add a record : ---------------------------------------------------------------------------------------- try { DB.BeginTransaction(); Entity odds = DB.Select<Entity>(p => p.MatchID == matchID, true).FirstOrDefault(); if (odds == null) { Entity entity = CreateEntity(matchID, data); DB.AddRecord(entity); } else { odds.CurrentOdds = data; } DB.CommitTransaction(); } catch (System.Exception ex) { DB.RollbackTransaction(); } ---------------------------------------------------------------------------------------- When Delete A record: ---------------------------------------------------------------------------------------- try { DB.BeginTransaction(); Entity odds = DB.Select<Entity>(p => p.MatchID == matchID, true).FirstOrDefault(); if (odds == null) { Entity entity = CreateEntity(matchID, data); DB.DeleteRecord(entity); } DB.CommitTransaction(); } catch (System.Exception ex) { DB.RollbackTransaction(); } ---------------------------------------------------------------------------------------- When Select Record : ---------------------------------------------------------------------------------------- try { DB.BeginTransaction(); List<string[]> list = DB.Select<LiveOddsEntity>(p => p.CurrentOdds[OddsFieldEnum.MATCH_SEASON_NO] == seasonNo && p.CurrentOdds[OddsFieldEnum.MATCH_SEASON_NAME] == seasonName && p.CurrentOdds[OddsFieldEnum.ROUND_NUMBER] == matchDay).Select(r => r.CurrentOdds).ToList(); DB.CommitTransaction(); return list; } catch (Exception ex) { DB.RollbackTransaction(); return new List<string[]>(); } ---------------------------------------------------------------------------------------- Is it right ? Thanks, Best regards.
  3. OK . Thanks very much .
  4. Hi , I have a question , If i only want Perst run at in-memory mode. don't want it save in the file system. What must i do ? Best regards. Lin