c# - Multiple instances of EF 5.0 DbContext Concurrency -


I am trying to simulate a scenario with many different applications accessing my database. The way I am doing this is making 10 different threads, which makes some concurrent transactions and thus an example of my DbContext in each thread.

The problem is, DbContexts do not know about updates in other instances, so my question is, how can I ensure that there is no data incompatible with my DBCTtex?

If you use any level of segregation except the serial jab, then some levels of incompatible data At risk. In case of serial performance, it is expensive and used only in very specific circumstances.

Securitization specifies the following: Details can not read data that has been modified, but not yet committed by other transactions. Any other transaction can modify the data read by the current transaction until the current transaction is completed. Other transactions can not incorporate new rows with key values ​​that fall into the category of keys read from any statement in the current transaction till the current transaction is completed. Range lock is placed in the category of key values ​​that match the conditions of each statement executed in a transaction. It prevents any other transaction from updating or including any line that qualifies for any statement executed by the current transaction. This means that if any statement in any transaction is executed for the second time, then they will read the same set of rows. Category locks are done until the transaction is completed. This is the most restrictive of the level of isolation because it completely lock the keys and keeps the lock until the transaction is complete. Because concurrency is low, use this option only when necessary. This option has the same effect of stopping the set on all tables in all SELECT statements in a transaction.

Snapshot isolation will also prevent dirty, non-repeater and phantom, but does not prevent thread 1 and thread 2, seeing different data during overlapping time period.

SNAPSHOT specifies that data transmitted from any statement in the transaction will be a corresponding version of the transaction in the beginning of the transaction. Transactions can only recognize data modifications that were committed before beginning the transaction. Data modifications made by other transactions after the onset of the current transaction are not visible to the statements executed in the current transaction. The effect is that the statements given in the transaction receive a snapshot of the data present at the beginning of the transaction.

This is a very comprehensive topic, the transaction specifies an isolation level that defines the transaction in which a transaction is separated from the resources or data modifications performed by other transactions. needed. The level of separation is described as the side effect of compatibility, such as dirty reading or in the form of a phantom.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -