Batch updates in EF

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
peledkfir
Posts: 22
Joined: Sat 15 Jan 2011 11:06

Batch updates in EF

Post by 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

Shalex
Site Admin
Posts: 8239
Joined: Thu 14 Aug 2008 12:44

Post by 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/ ... html#Batch.

peledkfir
Posts: 22
Joined: Sat 15 Jan 2011 11:06

Post by 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

Shalex
Site Admin
Posts: 8239
Joined: Thu 14 Aug 2008 12:44

Post by 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?

peledkfir
Posts: 22
Joined: Sat 15 Jan 2011 11:06

Post by peledkfir » Fri 02 Sep 2011 14:01

2. Because I need distributed transactions

Shalex
Site Admin
Posts: 8239
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 05 Sep 2011 12:57

2. TransactionScope (distributed transactions) cannot be used with batch updates.

Post Reply