Ejemplo n.º 1
0
 /// <summary>
 /// Please use this method with caution!
 /// </summary>
 protected virtual void FlushToPersient()
 {
     lock (_sync)
     {
         var content    = _currentRepositoryContextProvider.Current;
         var contextKey = content.Id;
         using (content)
         {
             content.Commit();
         }
         _repositoryContextManager.Create();
         CurrentRepositoryContextProvider.ReplaceCurrentContextKey(contextKey);
     }
 }
Ejemplo n.º 2
0
 protected void FlushToPersistence()
 {
     lock (_sync)
     {
         var content    = _currentRepositoryContextProvider.Current;
         var contextKey = content.Id;
         if (content == null || content.IsDisposed)
         {
             throw new ObjectDisposedException($"对象已被释放!ID: {contextKey}");
         }
         using (content)
         {
             content.Commit();
         }
         _repositoryContextManager.Create();
         CurrentRepositoryContextProvider.ReplaceCurrentContextKey(contextKey);
     }
 }