Professional C# 2012 and .NET 4.5 by Christian Nagel & Bill Evjen & Jay Glynn & Karli Watson & Morgan Skinner

Professional C# 2012 and .NET 4.5 by Christian Nagel & Bill Evjen & Jay Glynn & Karli Watson & Morgan Skinner

Author:Christian Nagel & Bill Evjen & Jay Glynn & Karli Watson & Morgan Skinner
Language: eng
Format: epub
Publisher: John Wiley & Sons
Published: 2012-10-08T04:00:00+00:00


FILE SYSTEM TRANSACTIONS

You can write a custom durable resource manager that works with the File and Registry classes. A file-based durable resource manager can copy the original file and write changes to the temporary file inside a temporary directory to make the changes persistent. When committing the transaction, the original file is replaced by the temporary file. Writing custom durable resource managers for files and the registry isn’t necessary since Windows Vista and Windows Server 2008. With these and subsequent operating systems, native transactions with the file system and the registry are supported. For this, there are Windows API calls such as CreateFileTransacted, CreateHardLinkTransacted, CreateSymbolicLinkTransacted, CopyFileTransacted, and so on. What these API calls have in common is that they require a handle to a transaction passed as an argument; they do not support ambient transactions. The transactional API calls are not available from .NET 4.5, but you can create a custom wrapper by using Platform Invoke.

NOTE Platform Invoke is discussed in more detail in Chapter 23, “Interop.”



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.