riteshrao / ncommon

A framework for implementing commonly used design patterns when using Domain Driven Design
www.codeinsanity.com
218 stars 61 forks source link

TransactionManager is not Thread Safe #17

Open duereg opened 13 years ago

duereg commented 13 years ago

The TransactionManager class is not Thread Safe. I've added locks to the following methods to solve the problem.

    public UnitOfWorkTransaction CurrentTransaction
    public void EnlistScope(IUnitOfWorkScope scope, TransactionMode mode)
    void OnTransactionDisposing(UnitOfWorkTransaction transaction)
    void Dispose(bool disposing)

Basically, anywhere the underlying _transactions object is changed needs to have a lock added.

ghost commented 12 years ago

Would use one type of collections in System.Collections.Concurrent (NET 4.0 ) solve the problem? But that binds NCommon to .net 4.0 only.