Grwon Grwon 61 2 2 bronze badges. Shiraz Bhaiji Shiraz Bhaiji Yes, but that's regular ADO. Wrong answer! NET object. The best approach these days is to use TransactionScope; it's integrated into more parts of the framework, and it's implicit nature means it's much easier. Entlib fully supports TransactionScope as of Entlib 3. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.
Related Then, you can use configuration tool that ships with the library to configure it. If you have application configuration file already part of your solution, you can right-click on it and choose Edit Enterprise Library Configuration menu.
Once, we completed those steps, we noticed that some errors where not logged. What was strange is that I saw gaps in identity column values in log table. This led me to believe that errors were logged, but not committed. Upon further investigation, I found out that logging transactions where rolled back when application errors occurred. Main reason for that was that our data access code was wrapped inside TransactionScope block.
This happen to be a feature that logging to database has — it does not opt out of ambient transaction scope. This can be done by using overloaded constructor:. You need to replace both because they work in conjunction. The only difference in FormattedDatabaseTraceListenerData is the creation of trace listener based on our new type:. Configuration; using System.
Diagnostics; using System. Expressions; using Microsoft. ContainerModel; using Microsoft. Design; using Microsoft. Configuration; using Microsoft. None, SourceLevels. I kept the rest of the code the same. Listener itself has more changes, specifically, I am wrapping all database access code with new transaction scope:.
Data; using System. Common; using System. Globalization; using System. Transactions; using Microsoft. Logging; using Microsoft. Formatters; using Microsoft. Empty; Microsoft. Information, string. Empty, DateTime. Now, string. Empty, string. Empty, null , null , message, database ; transaction. Int32, eventId ; db. AddInParameter cmd, "priority" , DbType. Int32, priority ; db. AddParameter cmd, "severity" , DbType. File: BrandsDAO. Int32, brand.
BrandId ; db. UpdateDataSet brand. DsCategories, brand. Example 7. Int32, itemTransfer. TransferId ; db. Int32, "Quantity", DataRowVersion. BranchFrom ; db. BranchTo ; db. UpdateDataSet itemTransfer. DsTransferInvoiceItems, itemTransfer. Example 8. File: VoucherDAO. Int32, voucher. VoucherID ; db. UpdateDataSet voucher. DsVoucherDetails, voucher. Example 9.
Int64, "Id",DataRowVersion. Int64, grn. GRNId ; db. Int64, "Id" ;not yet done db. UpdateDataSet grn. GRNItems, grn. Example Int32, pr. PRId ; db. Int32, "Qty", DataRowVersion. UpdateDataSet pr. DsReturnDetails, pr. File: DatabaseExtensions. File: InvoiceDAO. Int64, "Quantity", DataRowVersion. Int32, invoice. InvoiceId ; db. Currency, "Price", DataRowVersion. UpdateDataSet invoice. DsInvoiceDetails, invoice. Int64, reservationRoom. String, "Sharers", DataRowVersion.
Decimal, "Days", DataRowVersion. Decimal, "Rate", DataRowVersion. UpdateDataSet reservationRoom.
0コメント