transactions

How to implement ambient transaction in Entity Framework Core?

你说的曾经没有我的故事 提交于 2020-01-22 15:15:08
问题 I need to realize transaction under two models (using two separated bounded contexts). So code like this: using (TransactionScope scope = new TransactionScope()) { //Operation 1 using(var context1 = new Context1()) { context1.Add(someCollection1); context1.SaveChanges(); } //Operation 2 using(var context2 = new Context2()) { context2.Add(someCollection2); context2.SaveChanges(); } scope.Complete(); } return the exception: An ambient transaction has been detected. Entity Framework Core does

How to implement ambient transaction in Entity Framework Core?

家住魔仙堡 提交于 2020-01-22 15:14:09
问题 I need to realize transaction under two models (using two separated bounded contexts). So code like this: using (TransactionScope scope = new TransactionScope()) { //Operation 1 using(var context1 = new Context1()) { context1.Add(someCollection1); context1.SaveChanges(); } //Operation 2 using(var context2 = new Context2()) { context2.Add(someCollection2); context2.SaveChanges(); } scope.Complete(); } return the exception: An ambient transaction has been detected. Entity Framework Core does

Exit and rollback everything in script on error

与世无争的帅哥 提交于 2020-01-22 14:17:07
问题 I have a TSQL script that does a lot of database structure adjustments but it's not really safe to just let it go through when something fails. to make things clear: using MS SQL 2005 it's NOT a stored procedure, just a script file (.sql) what I have is something in the following order BEGIN TRANSACTION ALTER Stuff GO CREATE New Stuff GO DROP Old Stuff GO IF @@ERROR != 0 BEGIN PRINT 'Errors Found ... Rolling back' ROLLBACK TRANSACTION RETURN END ELSE PRINT 'No Errors ... Committing changes'

Preferable way to write Delphi database apps with transactions & data-aware components

匆匆过客 提交于 2020-01-22 14:04:17
问题 What is the preferable way to write Delphi database applications using transactions and also data-aware components? I have to write a client app that access InnoDB tables, and do some master-detail kind of things inside transactions. After doing some research on transactions (from general point-of-view), then I humbly make a conclusion that non data-aware components and hand-coded SQL would be the "perfect match" of transactions; But the data-aware components wouldn't be. They don't seem to

Preferable way to write Delphi database apps with transactions & data-aware components

大城市里の小女人 提交于 2020-01-22 14:02:51
问题 What is the preferable way to write Delphi database applications using transactions and also data-aware components? I have to write a client app that access InnoDB tables, and do some master-detail kind of things inside transactions. After doing some research on transactions (from general point-of-view), then I humbly make a conclusion that non data-aware components and hand-coded SQL would be the "perfect match" of transactions; But the data-aware components wouldn't be. They don't seem to

Force query execution without flush/commit

自古美人都是妖i 提交于 2020-01-22 12:37:05
问题 Hi i am using the transaction-per-request (session-in-view) pattern for an asp.net web application. I have a couple of points in the application where i want to Save an NHibernate managed entity and then do a couple of more inserts and updates using common sql. These inserts/updates depend on the ID that the NH saved entity will take. The problem is that the generated id does not exist in the transactions' scope. If i force a flush/commit the id is persisted but if the inserts/updates fail i

Why use SELECT FOR UPDATE?

好久不见. 提交于 2020-01-22 09:42:11
问题 I have question regarding what purpose we are using SELECT FOR UDPATE ? What does it do exactly? I have 2 tables, from that I need to select rows from table and update the same rows. For example: Select Query SELECT * from t1 WHERE city_id=2 for update Update Query UPDATE t1 SET final_balance = final_balance - 100 WHERE city_id ='2' My question - Does this really lock the read operation till my update is done, or what does it exactly deal with? My idea is nobody can read/update from/to this

Why use SELECT FOR UPDATE?

拟墨画扇 提交于 2020-01-22 09:39:08
问题 I have question regarding what purpose we are using SELECT FOR UDPATE ? What does it do exactly? I have 2 tables, from that I need to select rows from table and update the same rows. For example: Select Query SELECT * from t1 WHERE city_id=2 for update Update Query UPDATE t1 SET final_balance = final_balance - 100 WHERE city_id ='2' My question - Does this really lock the read operation till my update is done, or what does it exactly deal with? My idea is nobody can read/update from/to this

Why use SELECT FOR UPDATE?

試著忘記壹切 提交于 2020-01-22 09:38:45
问题 I have question regarding what purpose we are using SELECT FOR UDPATE ? What does it do exactly? I have 2 tables, from that I need to select rows from table and update the same rows. For example: Select Query SELECT * from t1 WHERE city_id=2 for update Update Query UPDATE t1 SET final_balance = final_balance - 100 WHERE city_id ='2' My question - Does this really lock the read operation till my update is done, or what does it exactly deal with? My idea is nobody can read/update from/to this

Why use SELECT FOR UPDATE?

浪子不回头ぞ 提交于 2020-01-22 09:38:11
问题 I have question regarding what purpose we are using SELECT FOR UDPATE ? What does it do exactly? I have 2 tables, from that I need to select rows from table and update the same rows. For example: Select Query SELECT * from t1 WHERE city_id=2 for update Update Query UPDATE t1 SET final_balance = final_balance - 100 WHERE city_id ='2' My question - Does this really lock the read operation till my update is done, or what does it exactly deal with? My idea is nobody can read/update from/to this