![]() |
VOOZH | about |
dotnet add package TxFileManager --version 1.5.0.1
NuGet\Install-Package TxFileManager -Version 1.5.0.1
<PackageReference Include="TxFileManager" Version="1.5.0.1" />
<PackageVersion Include="TxFileManager" Version="1.5.0.1" />Directory.Packages.props
<PackageReference Include="TxFileManager" />Project file
paket add TxFileManager --version 1.5.0.1
#r "nuget: TxFileManager, 1.5.0.1"
#:package TxFileManager@1.5.0.1
#addin nuget:?package=TxFileManager&version=1.5.0.1Install as a Cake Addin
#tool nuget:?package=TxFileManager&version=1.5.0.1Install as a Cake Tool
Transactional File Manager is a .NET Standard 2.0 library that supports including file system operations such as file copy, move, delete, append, etc. in a transaction. It's an implementation of System.Transaction.IEnlistmentNotification.
This library allows you to wrap file system operations in transactions like this:
// Wrap a file copy and a database insert in the same transaction
IFileManager fm = new TxFileManager();
using (TransactionScope scope1 = new TransactionScope())
{
// Copy a file
fm.Copy(srcFileName, destFileName);
// Insert a database record
db.ExecuteNonQuery(insertSql);
scope1.Complete();
}
Support the following file operations in transactions:
If you have any suggestions for enhancements or bug reports please use the Issues list. Better yet, if possible join this project and contribute.
This library is available as a NuGet package. The current/latest release is 1.4.
This started out as a blog post. It was hosted on CodePlex and migrated to GitHub in 3/2020.
Additional contributors: @gvas, AirBreather.
dotnet add package TxFileManager
IFileManager fm = new TxFileManager();
using (TransactionScope scope1 = new TransactionScope())
{
// Copy a file
fm.Copy(srcFileName, destFileName);
scope1.Complete();
}
In a PowerShell/Command window:
dotnet test
In Visual Studio, open Test/Text Explorer and choose Run All Tests (or CTRL-R, A)
The recommended method is to add a NuGet reference:
dotnet add package TxFileManager
Or Use Visual Studio's Manage NuGet Packages to add. Search for "TxFileManager".
It's not expensive to create new instances of TxFileManager as needed. There's a bit of overhead (like creating instances of any small class) but not much.
On the other hand, it's totally safe to re-use the same instance for multiple transactions, even nested transactions.
Yes - it's been tested for that.
Regardless of the specified IsolationLevel, the effective IsolationLevel is ReadUncommitted.
See Chinh's blog post: Include File Operations in Your Transactions Today with IEnlistmentNotification
By default, the path returned by Path.GetTempPath() is used to keep temporary files/directories used by TxFileManager. However, you can override that and have TxFileManager use another temp path:
IFileManager fm = new TxFileManager(myTempPath);
dotnet test)Notes: A release branch will be created out of the master branch when a release is made. The master branch will contain the latest features being added/tested for the next release.
Please suggest your features using the Issues list.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 4 NuGet packages that depend on TxFileManager:
| Package | Downloads |
|---|---|
|
Micro.Net.Transport.FileSystem
File system-based (FileSystemWatcher) transport component to be used as a base for transports for Micro.NET |
|
|
CKAN
Manages mods for KSP1 and KPS2 Signed by signpath.io from repository 'https://github.com/KSP-CKAN/CKAN.git' commit '975c4d7799ecaf2fb74ef5b1bbe6a182da3984d5' (see contained BuildSettings.json file for build settings). |
|
|
Bnsights.Providers.File.FileSystem
Bnsights.Providers.File.FileSystem contains a BaseFileProvider Implementation for FileSystem Bnsights Business Solutions Framework (BBSF) Package. |
|
|
mxProject.Data.FileRepository.TxFileManager
Repository Pattern Library. |
Showing the top 3 popular GitHub repositories that depend on TxFileManager:
| Repository | Stars |
|---|---|
|
tjackenpacken/taskbar-groups
Lightweight utility for organizing the taskbar through groups
|
|
|
KSP-CKAN/CKAN
The Comprehensive Kerbal Archive Network
|
|
|
Warewolf-ESB/Warewolf
Effortless Microservice Design and Integration. This repository includes the code-base for the Warewolf Studio and Server.
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.5.0.1 | 195,030 | 7/22/2021 | |
| 1.4.0 | 25,192 | 3/29/2020 | |
| 1.3.0 | 298,807 | 8/24/2013 | 1.3.0 is deprecated because it is no longer maintained. |
| 1.2.1 | 11,545 | 12/6/2011 | 1.2.1 is deprecated because it is no longer maintained. |
| 1.1.0.25 | 3,174 | 5/4/2011 | 1.1.0.25 is deprecated because it is no longer maintained. |
- Bug fix Async code (Issue #27)
- Added new operations: CopyDirectory, MoveDirectory
- Added Encoding support to WriteAllText, AppendAllText
- Nuget package icon
- Misc refactors/clean-up