我使用IBM.data.server通过实体框架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();
} 缺少的是什么配置?
发布于 2017-02-06 15:10:07
默认情况下,实体框架使用事务。完成所有的添加、更新、删除,然后使用save方法,仅此而已
https://stackoverflow.com/questions/42062044
复制相似问题