tailieunhanh - Programming C# 4.0 phần 8

Chỉ khác ở một điểm là khi chúng ta truy cập vào các proterties hoặc gọi các methods thì đầu CLR sẽ thực hiện tìm thành phần phù hợp, nếu không tìm thấy thì lúc này DLR mới gọi đến các phương thức mà chúng ta đã override để thực hiện các thao tác mà chúng ta quy định. | for as long as it needs to do a particular job it has to be an illusion because if clients really took it in turns scalability would be severely limited. So transactions perform the neat trick of letting work proceed in parallel except for when that would cause a problem as long as all the transactions currently in progress are working on independent data they can all proceed simultaneously and clients have to wait their turn only if they re trying to use data already involved directly or indirectly in some other transaction in The classic example of the kind of problem transactions are designed to avoid is that of updating the balance of a bank account. Consider what needs to happen to your account when you withdraw money from an ATM the bank will want to make sure that your account is debited with the amount of money withdrawn. This will involve subtracting that amount from the current balance so there will be at least two operations discovering the current balance and then updating it to the new value. Actually it ll be a whole lot more complex than that there will be withdrawal limit checks fraud detection audit trails and more. But the simplified example is enough to illustrate how transactions can be useful. But what happens if some other transaction occurs at the same time Maybe you happen to be making a withdrawal at the same time as the bank processes an electronic transfer of funds. If that happens a problem can arise. Suppose the ATM transaction and the electronic transfer both read the current balance perhaps they both discover a balance of 1 234. Next if the transfer is moving 1 000 from your account to somewhere else it will write back a new balance of 234 the original balance minus the amount just deducted. But there s the ATM transfer suppose you withdraw 200. It will write back a new balance of 1 034. You just withdrew 200 and paid 1 000 to another account but your account only has 200 less in it than before rather than 1 200 that s .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.