Note that there are some explanatory texts on larger screens.

plurals
  1. POTransactionScope doesn't rollback on exception CSLA 4.3
    primarykey
    data
    text
    <p>I have a BO (Country) with a child BO (State) which also has a child BO (City). When I update the parent BO (Country), add a child State and run save, when an exception occurs in the DAL (on purpose), the transaction is not rolled back. I am using SqlCE. I am attaching a sample stripped down project that demonstrates the issue. What am I doing wrong?</p> <p>Test code:</p> <pre><code> Country originalCountry = null; try { originalCountry = Country.GetCountry(1); var country = Country.GetCountry(1); country.CountryName = "My new name"; var state = country.States.AddNew(); state.StateName = "Dummy state"; country.States.EndNew(country.States.IndexOf(state)); country.Save(); } catch (Exception exception) { var country = Country.GetCountry(1); if (originalCountry.CountryName != country.CountryName) { System.Console.WriteLine("Values ARE NOT the same: " + originalCountry.CountryName + " vs. " + country.CountryName); } else { System.Console.WriteLine("Values are the same: " + originalCountry.CountryName + " vs. " + country.CountryName); } } </code></pre> <p>Country.cs</p> <pre><code>[Transactional(TransactionalTypes.TransactionScope)] protected override void DataPortal_Update() { Update(); } private void Update() { using (var ctx = DalFactory.GetManager()) { var dal = ctx.GetProvider&lt;ICountryDal&gt;(); using (BypassPropertyChecks) { var dto = new CountryDto(); TransferToDto(dto); dal.Update(dto); } FieldManager.UpdateChildren(this); throw new Exception("Rollback should occur."); } } </code></pre> <p><a href="https://sites.google.com/site/thepublicsite/Home/Csla4.3Test.zip?attredirects=0&amp;d=1" rel="nofollow">Sample project</a> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload