I was wondering if someone can suggest the best pattern to use in the above scenario, assuming that
A) StructureMap is used in the following way:
cfg.For<ISession>()
.LifecycleIs(new TransientLifecycle())
.Use(ctx => ctx.GetInstance<ISessionFactory>().OpenSession());
B) I would like all method calls to various services/repositories within a single controller action wrapped inside a TransactionScope, meaning if any of the actions goes wrong, then none of them should be committed.
I read somewhere that the session must be constructed within the TransactionScope block if this were to work which in my case is not so given that session is injected within each repository by Structuremap.