Transactions in mvc


Where my transactions ( commit and Rollback ) should be seated ? in Controller or in my Services.

I've got the follow cenarios. ( WPF -> WCF -> DB )

Many Thanks
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>> Where my transactions ( commit and Rollback ) should be seated ?

This is not the right question to ask in a distributed transactions scenario because conceptually there is no centralized control of commit/rollback. All participants have equal right to commit or rollback, unless ofcourse if you design your services to refrain from doing any commit and rollback.

WCF neatly encapsulates transaction scope such that a service can either enlist in clients provided transaction or if the client does not provide any then it starts a new scope. I think the right way to do this would be to keep the services flexible enough. Check this for example

This way in future if you want the client to control transaction like for example should you wish to use Transactional FileSystem API to tie in file operations inside the same transaction then that would work seamlessly with existing services.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MortarelloAuthor Commented:
Thanks Man
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.