I am migrating my project from Spring.Net to Simple Injector. In Spring.Net, there is a concept of having several functions nested under a single transaction using transaction decorator. The functionality of the Transaction decorator was to Rollback the transactions (including the DB inserts/updated) on Error across nested functions / service functions which would have a DB call individually.
Is there any equivalent in Simple Injector?
Sample Code of Spring.NET below
User Service
[Transaction(TransactionPropagation.Required)]
public bool RegisterUser(UserModel)
{
//Insert User DB Call
int result = _Userrepository.UserInsert(UserModel);
_subscriberservice.InsertSubscriber(UserModel);
}
Subscriber Service
public bool InsertSubscriber(UserModel);
{
//Insert Subscriber DB Call
int result = _subscriberrepository.SubscriberInsert(UserModel);
}
If the Insert Subscriber Service Insert fails, the User Insert also has to Roll back