1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      文件事物管理TransactionalFileManager的示例分析-創(chuàng)新互聯(lián)

      這篇文章將為大家詳細(xì)講解有關(guān)文件事物管理Transactional File Manager的示例分析,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

      創(chuàng)新互聯(lián)長期為上千多家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為夏河企業(yè)提供專業(yè)的做網(wǎng)站、成都網(wǎng)站制作夏河網(wǎng)站改版等技術(shù)服務(wù)。擁有十載豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。

      Project Description

      Transactional File Manager is a .NET API 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 (works with System.Transactions.TransactionScope).

      This library allows you to wrap file system operations in transactions like this:

      // Wrap a file copy and a database insert in the same transactionTxFileManager fileMgr = new TxFileManager();using (TransactionScope scope1 = new TransactionScope())
      {// Copy a file
      fileMgr.Copy(srcFileName, destFileName);// Insert a database record
      dbMgr.ExecuteNonQuery(insertSql);scope1.Complete();
      }

      Current Features

      • Support the following file operations in transactions:

        • AppendAllText

        • Copy

        • CreateDirectory

        • DeleteDirectory

        • DeleteFile

        • Move

        • Snapshot

        • WriteAllText

        • WriteAllBytes

      This library supports any file system and is not a wrapper over Transactional NTFS (see AlphaFS).

      Examples

      // Completely unrealistic example showing how various file operations, including operations done // by library/3rd party code, can participate in transactions.IFileManager fileManager = new TxFileManager();using (TransactionScope scope1 = new TransactionScope())
      {    fileManager.WriteAllText(inFileName, xml);    // Snapshot allows any file operation to be part of our transaction.
          // All we need to know is the file name.
          //The statement below tells the TxFileManager to remember the state of this file.
          // So even though XslCompiledTransform has no knowledge of our TxFileManager, the file it creates (outFileName)
          // will still be restored to this state in the event of a rollback.
          fileManager.Snapshot(outFileName);    XslCompiledTransform xsl = new XslCompiledTransform(true);    xsl.Load(uri);    xsl.Transform(inFileName, outFileName);    // write to database 1. This database op will get committed/rolled back along with the file operations we are doing in this transaction.
          myDb1.ExecuteNonQuery(sql1);    // write to database 2. The transaction is promoted to a distributed transaction here.
          myDb2.ExecuteNonQuery(sql2);    // let's delete some files
          for (string fileName in filesToDelete)
          {
              fileManager.Delete(fileName);
          }    // Just for kicks, let's start a new nested  transaction. Since we specify RequiresNew here, this nested transaction
          // will be committed/rolled back separately from the main transaction.
          // Note that we can still use the same fileManager instance. It knows how to sort things out correctly.
          using (TransactionScope scope2 = new TransactionScope(TransactionScopeOptions.RequiresNew))
          {        fileManager.MoveFile(anotherFile, anotherFileDest);
          }    // move some files
          for (string fileName in filesToMove)
          {
              fileManager.Move(fileName, GetNewFileName(fileName));
          }    // Finally, let's create a few temporary files...
          // disk space has to be used for something.
          // The nice thing about FileManager.GetTempFileName is that
          // The temp file will be cleaned up automatically for you when the TransactionScope completes.
          // No more worries about temp files that get left behind.
          for (int i=0; i<10; i++)
          {
              fileManager.WriteAllText(fileManager.GetTempFileName(), "testing 1 2");
          }    scope1.Complete();    // In the event an exception occurs, everything done here will be rolled back including the output xsl file.}

      這是一個開源項目。原始項目網(wǎng)站是  事務(wù)文件管理器。

      關(guān)于“文件事物管理Transactional File Manager的示例分析”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

      另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。


      網(wǎng)站欄目:文件事物管理TransactionalFileManager的示例分析-創(chuàng)新互聯(lián)
      轉(zhuǎn)載來源:http://www.ef60e0e.cn/article/ceodse.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        莲花县| 澄城县| 抚宁县| 克什克腾旗| 陈巴尔虎旗| 论坛| 华宁县| 伊春市| 小金县| 锦屏县| 大荔县| 长武县| 通江县| 汝城县| 古田县| 会昌县| 谷城县| 海淀区| 白城市| 龙口市| 喀喇沁旗| 涟源市| 兴仁县| 洱源县| 大石桥市| 莱州市| 错那县| 敖汉旗| 屏东县| 南宫市| 乌拉特后旗| 汨罗市| 宁河县| 托克逊县| 额尔古纳市| 平昌县| 湘乡市| 刚察县| 苍南县| 饶河县| 临湘市|