मुझे पता है कि यह देर से उत्तर देने वाला है, लेकिन मुझे इसे साझा करना उपयोगी लगा।
अब EF6 . में dbContext.Database.BeginTransaction()
का उपयोग करके इसे हासिल करना आसान है
इस तरह:
using (var context = new BloggingContext())
{
using (var dbContextTransaction = context.Database.BeginTransaction())
{
try
{
// do your changes
context.SaveChanges();
// do another changes
context.SaveChanges();
dbContextTransaction.Commit();
}
catch (Exception)
{
dbContextTransaction.Rollback();
}
}
}
अधिक जानकारी के लिए देखें यह
फिर से यह EF6 आगे में है