1

How can I use transactional operation between multiple database with Entity framework core ((2.1))? (Distributed Transaction)

try
{

    using (var tranScope = new TransactionScope())
    {
        using (var ctx1 = new TestDBContext())
        using (var ctx2 = new TestDB2Context())
        {
            ctx1.Person.Add(new Person { Name = "piran" });

            ctx2.Course.Add(new Course { Name = "C#" });

            ctx1.SaveChanges();
            ctx2.SaveChanges();
        }

        tranScope.Complete();
    }

}
catch(Exception ex)
{
    Debug.WriteLine(ex.Message);
}

When running above code I give this exception:

This platform does not support distributed transactions

Babak Golkar
  • 147
  • 9

0 Answers0