首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

找不到Connection.CreateConnectionScope(),命名空间是什么?解决思路

2012-03-20 
找不到Connection.CreateConnectionScope(),命名空间是什么?提示:System.Data.Common.DbConnection 不包含

找不到Connection.CreateConnectionScope(),命名空间是什么?
提示:System.Data.Common.DbConnection 不包含 CreateConnectionScope

C# code
using (var dbtran = new TransactionScope(TransactionScopeOption.Required))            {                using (var t= new TestEntities())                {                     using (t.Connection.CreateConnectionScope())// EF Extension中的扩展方法,作用是open connection并在dispose里释放它                    {                                                 t.AddToTableA(t1);                            t.SaveChanges();                            var cmd = t.CreateStoreCommand("update form set xxx=xxx where formid=2", CommandType.Text);          cmd.ExcuteNonQuery();                            dbtran.Complete();                      }      }    }


[解决办法]
using Microsoft.Data.Extensions;

http://archive.msdn.microsoft.com/EFExtensions/Release/ProjectReleases.aspx?ReleaseId=3624

热点排行