在TransactionScope中打开sql连接时,会出现"Enlisting in Ambient transactions is not supported"错误。我正在使用asp.net core 2应用程序中的ado.net。
using (var ts = new TransactionScope())
{
try
{
Connection.Open();
repository.Insert(entity);
ts.Complete();
}
catch (Exception ex)
{
ts.Dispose();
}
finally
{
Connection.Close();
}
}