About this exception report, because the transaction can not be recycled submitted, the transaction can only be submitted once a method.
System.InvalidOperationException:This.NpgsqlTransaction has completed;it is no longer usable. at Npgsql.NpgsqlTransaction.CheckCompleted() in ...
Proper use
the using ( var Pay = _postgreDbContext.Database.BeginTransaction ()) { the try { billItem.review_remark = " through " ; the foreach ( var Item in Settlement) { item.status = 2 ; } _postgreDbContext.SaveChanges (); pay.Commit () ; // Note placed outside the loop } the catch (Exception EX) { the throw ex; } }