jeudi 14 janvier 2016

Nested Transaction issue with UnitOfWork Pattern

public void Operation01()
{
    //Some Data manipulation here.
    this.UnitOfWork.Commit();
}

public void Operation02()
{
    Operation01();

    //Some db work here

    //Some ERROR Occurs here, but operation 1 is commited.

    this.UnitOfWork.Commit();  
}

UnitOfWork is a private member of the class injected by framework using IOC.

I cannot remove Commit() from Operation01 because it is called as a stand alone operation sometimes in application. I want to rollback every changes if any error occurs on Operation02().

Aucun commentaire:

Enregistrer un commentaire