我使用IBM.data.server使用Entity Framework 6连接informix
using (var test = new COMMONEntities())
{
var configs = from a in test.SYS_CONFIG select a ;
foreach ( var u in configs)
{
Console.WriteLine(u.ID);
}
}
连接就可以了! 但是,当我使用System.Transactions时,它无法连接到数据库
System.Transactions.TransactionOptions transactionOptions = new TransactionOptions();
transactionOptions.IsolationLevel =IsolationLevel.ReadCommitted;
using (var transactionScope = new System.Transactions.
TransactionScope(TransactionScopeOption.Required, transactionOptions))
{
using (var test2 = new COMMONEntities())
{
var configs = from a in test2.SYS_CONFIG select a;
foreach (var u in configs) 《== here will Exception (db2 can’t open )
{
Console.WriteLine(u.ID);
}
transactionScope.Complete();
}
缺少什么配置?
答案 0 :(得分:0)
默认情况下,实体框架使用事务。完成所有添加,更新,删除,然后使用保存方法,这都是