I decided to create a system for the client using Castle ActiveRecord , everything went fine until I found that the transactions did not work, for the instance;
TransactionScope t = new TransactionScope(); try { member.Save(); //This is just to see transaction working throw new Exception("Exception"); foreach (qfh.Beneficiary b1 in l) { b1.Create(); } } catch (Exception ex) { t.VoteRollBack(); MessageBox.Show(ex.Message); } finally { t.Dispose(); }
But this will not work, I throw an exception to try rollback transactions, but, to my surprise, I see that the first [Save] records are written to the database. What's happening?
I am new to Castle and NHibernate, firstly, I saw it very attractive, and I decided to continue with it and MySQL (I never worked with this database), I tried ActiveWriter, and it seemed very promising, but after a long and effortly weeks I see this problem, and now I feel like I'm stuck and how I wasted my time. This is supposed to be easy, but right now I feel a tired reason, I canโt find enough information for this workout, can you help me?
source share