Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The DalManager (and the ConnectionManager) relies on reference counting to determine when close the actual connection.</p> <p>The rules are not making sure to dispose the DalManager and hence the DalManager and reference counting is off. Resulting in the update happening on a connection that was created and opened in one of the Fetch operations and is therefore not be enlisted in the TransactionScope on the Update method.</p> <p>See: <a href="http://msdn.microsoft.com/en-us/library/bb896149%28v=sql.100%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb896149%28v=sql.100%29.aspx</a></p> <p>All rules must be changed to dispose of the DalManager. Original rule:</p> <pre><code> protected override void Execute(RuleContext context) { var name = (string)context.InputPropertyValues[_nameProperty]; var id = (int)context.InputPropertyValues[_idProperty]; var dal = DalFactory.GetManager(); var countryDal = dal.GetProvider&lt;ICountryDal&gt;(); var exists = countryDal.Exists(id, name); if (exists) { context.AddErrorResult("Country with the same name already exists in the database."); } } </code></pre> <p>DalManager is IDisposable but is not explicitly disposed here so it depends on when the GC will actually collect the object.</p> <p>Should be:</p> <pre><code> protected override void Execute(RuleContext context) { var name = (string)context.InputPropertyValues[_nameProperty]; var id = (int)context.InputPropertyValues[_idProperty]; using (var dal = DalFactory.GetManager()) { var countryDal = dal.GetProvider&lt;ICountryDal&gt;(); var exists = countryDal.Exists(id, name); if (exists) { context.AddErrorResult("Country with the same name already exists in the database."); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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