title: File System Transactions using .NET on WinXP
body: <p>I'm using WinXP on clients and Win2003 on a server.</p>
  
  <p>I need do atomic actions: create-moving files, insert-update database.</p>
  
  <p>Are there any good practices for file system transactions using WinXP?
  I know in Vista/Win2008/Win7 there are TxF transaction (NTFS) but <strong>not</strong> in WinXP.</p>
  
  <p>I don't want use COM+, neither other complex solutions. Only need good sample code, for good practices.</p>
  
  <blockquote>
    <p><a href="http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/5f619a2645f2eb93/f76e85c6d648e669" rel="nofollow noreferrer">Transactions and file-actions by Alberto Poblacion</a></p>
    
    <p>In versions of Windows earlier than Vista, the filesystem is not
    transactional, so you need a separate tool to do transactions on your files.</p>
    
    <p>You could use Component Services (COM+) to implement a Compensating Resource
    Manager (CRM). The CRM will provide the transaction log and will roll back
    changes during a system restart if it crashed during the update of your
    files, but you will have to provide the code (in your own DLL) to commit and
    rollback the transation, typically by means of moving files in and out of a
    temp folder. It can all be done in .Net by means of the
    System.EnterpriseServices namespace. If I recall correctly, Microsoft
    Official Course 2557 contains a chapter that teaches how to create a CRM,
    and the example that they use is built precisely on changes to the
    filesystem.</p>
    
    <p>In newer versions of Windows, you can do transactional operations on
    NTFS:</p>
    
    <p><a href="http://msdn.microsoft.com/en-us/library/bb986748(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb986748(VS.85).aspx</a></p>
    
    <p><a href="http://msdn.microsoft.com/en-us/magazine/cc163388.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163388.aspx</a></p>
    
    <p><a href="http://codeproject.com/KB/vista/VistaKTM.aspx" rel="nofollow noreferrer">http://codeproject.com/KB/vista/VistaKTM.aspx</a> </p>
  </blockquote>
  
  <p>Edit.</p>
  
  <p>References:</p>
  
  <p><a href="https://transactionalfilemgr.codeplex.com/" rel="nofollow noreferrer">https://transactionalfilemgr.codeplex.com/</a></p>
  
  <p><a href="http://www.codeproject.com/Articles/690136/All-About-TransactionScope" rel="nofollow noreferrer">http://www.codeproject.com/Articles/690136/All-About-TransactionScope</a></p>
  
  <p><a href="http://ayende.com/blog/4528/who-stole-my-transaction" rel="nofollow noreferrer">http://ayende.com/blog/4528/who-stole-my-transaction</a></p>
  
  <p><a href="http://www.chinhdo.com/20080825/transactional-file-manager/" rel="nofollow noreferrer">http://www.chinhdo.com/20080825/transactional-file-manager/</a></p>
  
  <p><a href="http://bmegias.wordpress.com/2010/10/25/ejecutar-acciones-al-finalizar-la-transaccion-transactioncompleted-vs-enlistvolatile/" rel="nofollow noreferrer">http://bmegias.wordpress.com/2010/10/25/ejecutar-acciones-al-finalizar-la-transaccion-transactioncompleted-vs-enlistvolatile/</a></p>