Reputation: 3761
We're trying to implement a quick prototype to prove something is possible with the Entity Framework...
We have an Informix DB that doesn't support transactions - is it possible to use the Entity Framework with this?
We have a working model, and the working providers, but it doesn't seem we can execute a CRUD query without transactions kicking in - we've even tried to surpress them...
[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're getting is below:
An error occurred while starting a transaction on the provider connection. See the inner exception for details.
I've looked around, and whats suggested is to use the suppression, but it doesn't seem to work... any ideas?
Upvotes: 5
Views: 3902
Reputation: 364349
To answer your main question (I know nothing about Informix) - you cannot supress transaction. If SaveChanges
doesn't find existing transaction it will always start a new one on the provider. It is key feature of EF to run SaveChanges
in transaction.
Btw. I checked IBM Data Provider and I found only support for EFv1 so features from EFv4 and EFv4.1 don't have to work (unless there is some newer version of the provider).
Upvotes: 3