Error on using TransactionScope in EF4 & SQL Compact 4

前端 未结 2 1947
悲哀的现实
悲哀的现实 2020-12-21 19:18
using (TransactionScope scope = new TransactionScope())
using (var context = new dwfEntities())
{
  var field = (from x in context.DynFields where x.Id == id select          


        
相关标签:
2条回答
  • 2020-12-21 19:57

    in case SQL CE does not support transaction scope, you can surely use the normal transactional approach, connection.BeginTransaction then transaction.Commit or Rollback...

    0 讨论(0)
  • 2020-12-21 20:09

    If the connection is opened outside of the transaction scope you need to explicitly call EnlistTransaction. You cannot implicitly use a connection with a transaction scope in SQL CE as described here

    0 讨论(0)
提交回复
热议问题