There have been a number of discussions over the past year regarding
how SA handles (NHibernate) transactions via the Transaction
attribute:
I'd like to revisit this topic, and hopefully come to a conclusion
about the current best practices.
I'd especially like to put things in perspective with Tom's SA Contrib
Transaction and UnitOfWork Attributes:
http://wiki.sharparchitecture.net/SharpArchContrib.ashx
I am more than willing to turn our results into a Wiki page, so please
contribute as much as you can!
To frame the discussion, here are some points that would really help
me in clarifying the setup:
1) How does the SA Contrib Transaction Attribute relate to the regular
SA Transaction Attribute?
Can you use them together? For example, decorate the Controller action
method with an SA Transaction Attribute, and then decorate the Domain
Services (or Application Services) that the controller invokes with
the SA Contrib Transaction Attribute?
2) How does the SA Contrib Transaction Attribute relate to the SA
Contrib UnitOfWork Attribute?
The documentation seems to be conflicting here:
"Transaction PostSharp Attribute (Supports NHibernate or
System.Transaction. Works With ASP.NET, WCF, Windows GUI and Windows
Service Applications)"
http://wiki.sharparchitecture.net/SharpArchContrib.ashx
"You should use UnitOfWork in all Windows applications."
http://wiki.sharparchitecture.net/ContribUnitOfWork.ashx
Can the SA Contrib Transaction Attribute be used in a non-web
application?
3) Where should transaction management be placed? What layer is it a
concern of?
I've seen two general camps:
3a - Handle transactions in the Web.Controllers level with the SA
Transaction Attribute
3b - Handle transactions in the DomainServices or ApplicationServices
layers (presumably with the SA Contrib Transaction Attribute)
Is SA able to work with both types of setup?
4) How should exceptions be handled, in the context of transactions?
5) There are two types of transactions: NHibernate transactions, and
standard .NET transactions (Transaction.TransactionScope).
They are sometimes confused. Can the two be mixed? In what
circumstances should they be used together, if at all?
6) How can we utilize SA in a multi-client paradigm, in relation to
transactions?
This is the biggie for me, and likely crosses over all of the above
questions. Say I want my "core" app to be based of SA (Domain,
DomainServices, Infrastructure, etc), and then say I want to use this
"core" in both an SA-enabled website and another type of client (non-
SA enabled), like a Windows App or Service.
How can this be achieved? How can the "core" be implemented, so that
it can function in both "contexts"?
Since we are in DDD-land, a bit of terminology disclaiming is in
order:
Domain - POCO models
DomainServices - Domain level services/tasks that cross/mix (involve
more than one) entities (aggregate roots)
AppServices - Infrastructure level services. Services/processes like
"SendEmail" or "WriteFile" that involve interaction with external
resources
Thank you in advance for all your input.
Please note that my primary concern here is not for you to solve my
problems, but rather to facilitate a community process that will
hopefully end up with some solid guidelines/recommendations
documented.
Best regards,
Martin
--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To post to this group, send email to sharp-arc...@googlegroups.com.
To unsubscribe from this group, send email to sharp-architect...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sharp-architecture?hl=en.
I will revisit this topic this weekend, and update the wiki page you
created at that time.
Hopefully we'll be able to get some feedback on this.
Also, thank you for the link above. I'll give it a read tonight.
On Jan 7, 4:50 pm, Simone Busoli <simone.bus...@gmail.com> wrote:
> I have created this wiki page, orphan at the moment:http://wiki.sharparchitecture.net/Transactions.ashx
>
> On Thu, Jan 7, 2010 at 09:29, Simone Busoli <simone.bus...@gmail.com> wrote:
> > That's a very interesting topic, I definitely would like to see a wiki page
> > on it. I add to the mix this thread on the rhino-tools mailing list which
> > talks a lot about transactions:
> >http://groups.google.com/group/rhino-tools-dev/browse_thread/thread/5...
>
> > On Thu, Jan 7, 2010 at 03:30, Martin S <martinaat...@gmail.com> wrote:
>
> >> Hi All,
>
> >> There have been a number of discussions over the past year regarding
> >> how SA handles (NHibernate) transactions via the Transaction
> >> attribute:
>
> >>http://groups.google.com/group/sharp-architecture/browse_thread/threa...
>
> >>http://groups.google.com/group/sharp-architecture/browse_thread/threa...
>
> >>http://groups.google.com/group/sharp-architecture/browse_thread/threa...
>
> >> I'd like to revisit this topic, and hopefully come to a conclusion
> >> about the current best practices.
>
> >> I'd especially like to put things in perspective with Tom's SA Contrib
> >> Transaction and UnitOfWork Attributes:
>
> >>http://wiki.sharparchitecture.net/SharpArchContrib.ashx
>
> >>http://groups.google.com/group/sharp-architecture/browse_thread/threa...
> >> sharp-architect...@googlegroups.com<sharp-architecture%2Bunsu...@googlegroups.com>
I recently tried to use the UnitOfWork attribute in a project and
could not get it to work, transactions were not being opened or
committed and I ended up having to abandon using it. I have not yet
had time to review the SAContrib code to determine what I might be
doing wrong, but I plan to spend some time doing that this week.
On a somewhat related note, I also think that UnitOfWork and non-web-
session based session management is the sort of functionality that
should be considered for part of the core not just in Contrib, the
reasons I beleive that is another discussion altogether.
Chris
> > >> "You should useUnitOfWorkin all Windows applications."
Alec Whittington
Senior Consultant
Six Sigma Systems
602.320.1825
#Arch has been fantastic as a framework for 100% MVC projects, but the
rest of the world has difficulties getting to grips with the concepts,
especially with Forms / Services apps.
I note Alec's request that a new thread be opened, however I wanted to
register on this thread that those of us who are not 100% MVC (I'm
concentrating on SilverLight) have an uphill struggle that we want to
overcome.
Regards
Scott
On Mon, 18 Jan 2010 13:14:01 -0800 (PST), Chris Nicola
<chni...@gmail.com>
wrote:
To unsubscribe from this group, send email to sharp-architect...@googlegroups.com.
Thanks,
Chris
On Jan 18, 11:38 pm, Chris Nicola <chnic...@gmail.com> wrote:
> I just wanted to update I did get UoW working with the new castle
> interceptors earlier today. I will try to update the Wiki a little later if
> that's alright and I will start a new thread to discuss the merits of making
> UoW and the session-per-thread factory options available in #A.
>
> Thanks,
> Chris
>
> On Mon, Jan 18, 2010 at 10:09 PM, Scott Leckie <scott.lec...@kwolo.com>wrote:
>
> > I agree with what Chris has written.
>
> > #Arch has been fantastic as a framework for 100% MVC projects, but the
> > rest of the world has difficulties getting to grips with the concepts,
> > especially with Forms / Services apps.
>
> > I note Alec's request that a new thread be opened, however I wanted to
> > register on this thread that those of us who are not 100% MVC (I'm
> > concentrating on SilverLight) have an uphill struggle that we want to
> > overcome.
> > Regards
> > Scott
>
> > On Mon, 18 Jan 2010 13:14:01 -0800 (PST), Chris Nicola
> > <chnic...@gmail.com>
> > <sharp-architecture%2Bunsu...@googlegroups.com<sharp-architecture%252Buns...@googlegroups.com>
To unsubscribe from this group, send email to sharp-architect...@googlegroups.com.