{"id":13594347,"url":"https://github.com/chinhdo/txFileManager","last_synced_at":"2025-04-09T07:31:36.983Z","repository":{"id":45048898,"uuid":"247334397","full_name":"chinhdo/txFileManager","owner":"chinhdo","description":".NET Transactional File Manager is a .NET Standard library that allows you to enlist file operations (file/folder copies, writes, deletes, appends, etc.) in distributed transactions.","archived":false,"fork":false,"pushed_at":"2023-03-22T20:51:18.000Z","size":737,"stargazers_count":111,"open_issues_count":11,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-30T19:08:53.306Z","etag":null,"topics":["dotnet","dotnet-core","dotnet-standard","file-io","transactions"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chinhdo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-03-14T18:47:57.000Z","updated_at":"2024-07-18T16:53:34.000Z","dependencies_parsed_at":"2024-01-13T16:25:03.185Z","dependency_job_id":"de4d9347-3a3c-48be-8547-8a78a7ebddf5","html_url":"https://github.com/chinhdo/txFileManager","commit_stats":{"total_commits":90,"total_committers":7,"mean_commits":"12.857142857142858","dds":0.1777777777777778,"last_synced_commit":"e3b4b940598c21a58c4738abe4f8ef6a55976e5b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinhdo%2FtxFileManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinhdo%2FtxFileManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinhdo%2FtxFileManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinhdo%2FtxFileManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chinhdo","download_url":"https://codeload.github.com/chinhdo/txFileManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223375305,"owners_count":17135344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","dotnet-core","dotnet-standard","file-io","transactions"],"created_at":"2024-08-01T16:01:32.117Z","updated_at":"2024-11-06T16:31:12.068Z","avatar_url":"https://github.com/chinhdo.png","language":"C#","funding_links":[],"categories":["C#","C\\#"],"sub_categories":[],"readme":"Transactional File Manager is a .NET Standard 2.0 library that supports including file system operations such\nas file copy, move, delete, append, etc. in a transaction. It's an implementation of\nSystem.Transaction.IEnlistmentNotification.\n\nThis library allows you to wrap file system operations in transactions like this:\n\n``` csharp\n// Wrap a file copy and a database insert in the same transaction\nIFileManager fm = new TxFileManager();\nusing (TransactionScope scope1 = new TransactionScope())\n{\n    // Copy a file\n    fm.Copy(srcFileName, destFileName);\n\n    // Insert a database record\n    db.ExecuteNonQuery(insertSql);\n\n    scope1.Complete();\n} \n```\n\n# Current features\n\nSupport the following file operations in transactions:\n* AppendAllText: Appends the specified string the file, creating the file if it doesn't already exist.\n* Copy: Copy a file to another file.\n* Delete: Delete a file.\n* Move: Move a file.\n* CreateDirectory: Create a directory.\n* DeleteDirectory: Delete a directory.\n* MoveDirectory: Move a directory.\n* Snapshot: Take a snapshot of the specified file. The snapshot is used to rollback the file later if needed.\n* WriteAllBytes: Write the specified bytes to the file.\n* WriteAllText: Write the specified text content to the file.\n\nIf you have any suggestions for enhancements or bug reports please use the Issues list. Better yet, if possible join this project and contribute.\n\nThis library is available as a [NuGet](https://www.nuget.org/packages/TxFileManager) package.\n\nThis started out as a [blog post](http://www.chinhdo.com/20080825/transactional-file-manager/). It was hosted on [CodePlex](https://archive.codeplex.com/?p=transactionalfilemgr) and migrated to GitHub in 3/2020.\n\nAdditional contributors: @gvas, AirBreather.\n\n# Quick Start\n\n1. Add a reference to TxFileManager\n\n```\ndotnet add package TxFileManager\n```\n\n2. Start writing code\n\n``` csharp\nIFileManager fm = new TxFileManager();\nusing (TransactionScope scope1 = new TransactionScope())\n{\n    // Copy a file\n    fm.Copy(srcFileName, destFileName);\n\n    scope1.Complete();\n} \n```\n\n# Frequently Asked Questions\n\n## How do I reference this library?\n\nThe recommended method is to add a NuGet reference:\n\n```\ndotnet add package TxFileManager\n```\n\nOr Use Visual Studio's Manage NuGet Packages to add. Search for \"TxFileManager\".\n\n## Can I reuse instances of TxFileManager?\n\nIt'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.\n\nOn the other hand, it's totally safe to re-use the same instance for multiple transactions, even nested transactions.\n\n## Is TxFileManager Thread Safe?\n\nYes - it's been tested for that.\n\n## Which IsolationLevel's are supported?\n\nRegardless of the specified IsolationLevel, the effective IsolationLevel is ReadUncommitted.\n\n## How does TxFileManager work?\n\nSee Chinh's blog post: [Include File Operations in Your Transactions Today with IEnlistmentNotification](https://www.chinhdo.com/20080825/transactional-file-manager/)\n\n## Where are temporary files/directories kept?\n\nBy 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:\n\n```csharp\nIFileManager fm = new TxFileManager(myTempPath);\n```\n\n## How do I contribute to the project?\n\n* Fork the repo\n* Create a branch such as my-new-feature\n* Make your change/fix and associated unit tests and commit\n* Run the tests (```dotnet test```)\n* Open a Pull Request (PR) to the \"master\" branch\n\nNotes: 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.\n\n# [Nuget Releases](https://www.nuget.org/packages/TxFileManager/)\n\n## Version 1.4 (released 3/2020)\n\n* Add support for custom temp paths to address issues with file/dir operations accross filesystems\n* Fix for resource leak in TxFileManager._txEnlistment\n* Target .NET Standard 2.0\n* Additional testing for .NET Core on Ubuntu\n* Additional stress testing both on Windows and Ubuntu\n* Created Github workflow to automatically build/test on ubuntu\n* Added FxCop static analysis\n\n## Version 1.5.0.1 (released 7/21/2021)\n\n* Bug fix Async code ([Issue #27](https://github.com/chinhdo/txFileManager/issues/27))\n* Added new operations\n    * CopyDirectory\n    * MoveDirectory\n* [Added Encoding support to WriteAllText, AppendAllText](https://github.com/chinhdo/txFileManager/issues/26)\n* [Nuget package icon](https://github.com/chinhdo/txFileManager/issues/34)\n* Misc refactors/clean-up\n\nPlease suggest your features using the [Issues](https://github.com/chinhdo/txFileManager/issues) list.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinhdo%2FtxFileManager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinhdo%2FtxFileManager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinhdo%2FtxFileManager/lists"}