Batch updates in EF

Batch updates in EF

Postby peledkfir » Tue 30 Aug 2011 09:00

Hi,
I wish to know if there is a possibility to config only a specific context to use batch updates instead of configure it globally?
Another question, is there any way to use transactions with batch updates?

Thanks, Kfir
peledkfir
 
Posts: 22
Joined: Sat 15 Jan 2011 11:06

Postby Shalex » Thu 01 Sep 2011 15:32

peledkfir wrote:I wish to know if there is a possibility to config only a specific context to use batch updates instead of configure it globally?

Please use the following code to turn on/off batch updates:
Code: Select all
OracleEntityProviderConfig config = OracleEntityProviderConfig.Instance; 
config.DmlOptions.BatchUpdates.Enabled = true;
...
config.DmlOptions.BatchUpdates.Enabled = false;

peledkfir wrote:Another question, is there any way to use transactions with batch updates?

Each SaveChanges() is executed in its own local transaction. TransactionScope cannot be used with batch updates.

For more information, refer to http://www.devart.com/blogs/dotconnect/index.php/new-features-of-entity-framework-support-in-dotconnect-providers.html#Batch.
Shalex
Devart Team
 
Posts: 7527
Joined: Thu 14 Aug 2008 12:44

Postby peledkfir » Thu 01 Sep 2011 16:38

1. In multi-threaded application it seems that your solution for enabling batch will effect all thread in the application - which is not good enough for my case..
2. I already read that post. My question was if there an other way to work with transacation that is not TransactionScope with batches like beginTransaction

10x for your response
peledkfir
 
Posts: 22
Joined: Sat 15 Jan 2011 11:06

Postby Shalex » Fri 02 Sep 2011 11:01

1. Yes, this will effect all threads in the application. There is no other way.
2. Why do you need to wrap SaveChanges() in local transaction if it is executed in its own transaction?
Shalex
Devart Team
 
Posts: 7527
Joined: Thu 14 Aug 2008 12:44

Postby peledkfir » Fri 02 Sep 2011 14:01

2. Because I need distributed transactions
peledkfir
 
Posts: 22
Joined: Sat 15 Jan 2011 11:06

Postby Shalex » Mon 05 Sep 2011 12:57

2. TransactionScope (distributed transactions) cannot be used with batch updates.
Shalex
Devart Team
 
Posts: 7527
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle