try { TransactionOptions transOption = new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted }; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transOption)) { response.AssetTransactionHistory = new FaAssetTransactionHistory(); response.AssetTransactionHistory.Merge(request.AssetTransactionHistory); // Generate Asset Transaction History ID with GUID response.AssetTransactionHistory.HistoryId = Guid.NewGuid().ToString(); // Call ValidateAssetTransactionHistoryForCreate. If false, add message to respose object and return the response. if (!ValidateAssetTransactionHistoryForCreate(request.AssetTransactionHistory, response.Messages)) return response; // Call Add method from repository. _assetTransactionHistoryRepository.Add(response.AssetTransactionHistory); _assetTransactionHistoryRepository.SaveChanges(); ts.Complete(); } } catch (TransactionAbortedException transactionAbortedException) { // MFS0069: The transaction was aborted. Message errorMessage = MessageFactory.GetMessage("MFS0069", MessageType.Error); PopulateExtendedMessages(errorMessage.ExtendedValues, transactionAbortedException); response.Messages.Add(errorMessage); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)