Disabling Transactions in Entity Infrastructure

We are trying to implement a quick prototype to prove that something is possible with the Entity Framework ...

We have an Informix database that does not support transactions - is it possible to use the Entity Framework with this?

We have a working model and working providers, but it seems that we cannot execute a CRUD request without transactions, but we even tried to push them away ...

[Test] public void TestMethod1() { entities ent = new entities(); var a = ent.brands.Select(x => x); using (TransactionScope trans = new TransactionScope( TransactionScopeOption.Suppress)) { ent.brands.AddObject(new brand() { br_name = "New Test Brand" }); ent.SaveChanges(); } } 

The error we get is below:

An error occurred while starting a transaction in the provider connection. See Internal Exception for more details.

I looked around and suggested using suppression, but it doesn't seem to work ... any ideas?

+4
source share
1 answer

To answer your basic question (I don't know anything about Informix) - you cannot suppress a transaction. If SaveChanges does not find an existing transaction, it will always start a new one in the provider. This is a key feature of EF to run SaveChanges in a transaction.

Btw. I checked the "IBM Data Provider" and I found support only for EFv1, so the functions from EFv4 and EFv4.1 should not work (if there is no newer version of the provider).

+2
source

Source: https://habr.com/ru/post/1396682/


All Articles