コード例 #1
0
 void Events_SavedChanges(object sender, EntitySessionEventArgs e)
 {
     var entSession = (EntitySession)e.Session;
       var dur = (int)(App.TimeService.ElapsedMilliseconds - entSession.TransactionStart);
       //Filter out entities/records that we do not need to track
       var recChanged = entSession.RecordsChanged;
       if(recChanged.Count == 0)
     return;
       var filteredRecs = recChanged.Where(r => !r.EntityInfo.Flags.IsSet(EntityFlags.DoNotTrack)).ToList();
       if(filteredRecs.Count == 0)
     return;
       string changes = BuildChangeLog(filteredRecs);
       var user = entSession.Context.User;
       var userSession = entSession.Context.UserSession;
       var transEntry = new TransactionLogEntry(entSession.Context, entSession.TransactionDateTime, dur, entSession.TransactionRecordCount, changes);
       _saveService.AddObject(transEntry);
 }
コード例 #2
0
ファイル: EntityCache.cs プロジェクト: yuanfei05/vita
 void Events_SavedChanges(object sender, EntitySessionEventArgs args)
 {
     var session = (EntitySession)args.Session;
       bool fullSetCacheUpdated = false;
       foreach(var rec in session.RecordsChanged) {
     switch(rec.EntityInfo.CacheType) {
       case CacheType.FullSet:
     fullSetCacheUpdated = true;
     break;
       case CacheType.Sparse:
     switch(rec.StatusBeforeSave) {
       case EntityStatus.Deleting:
         _sparseCache.Remove(rec); break;
       default:
         _sparseCache.Add(rec);
         break;
     }//switch
     break;
     }
       }
       if(fullSetCacheUpdated) {
     _fullSetCache.Invalidate(); //it will be reloaded
     //_maxKnownVersion++; //tick up the version
       }
 }
コード例 #3
0
 void AppEvents_ExecutedNonQuery(object sender, EntitySessionEventArgs e)
 {
     // TODO: finish this, for now not sure what and how to do logging here
 }