Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Implicit transactions
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  15 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Vladan Strigo  
View profile  
 More options Sep 21 2009, 7:51 am
From: Vladan Strigo <vla...@strigo.net>
Date: Mon, 21 Sep 2009 04:51:27 -0700 (PDT)
Local: Mon, Sep 21 2009 7:51 am
Subject: Implicit transactions
Hi,

I've been thinking about this for a while...in NH its recommended to
put in transaction even the read operations. But to do something like:

Employee employee;
using (var tran = session.begintransaction())
{
   employee = somerepository.get<Employee>(1);

}

sounds like alot of code which could be minimized...I've had an idea,
only didnt test till now that Session.Transaction.IsActive could be
the key, and this morning read an article:

http://nhforge.org/blogs/nhibernate/archive/2009/09/20/part-10-testin...
(find WrapInTransaction method) which does exactly what I had in
mind...

so if there is an active transaction, use it, if not, create
one...this would make this code minimized to only this:

Employee employee = somerepository.get<Employee>(1);

(this, of course is only valid for single operation transactions).

What do you think?

Vladan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vladan Strigo  
View profile  
 More options Sep 22 2009, 7:04 am
From: Vladan Strigo <vla...@strigo.net>
Date: Tue, 22 Sep 2009 04:04:23 -0700 (PDT)
Local: Tues, Sep 22 2009 7:04 am
Subject: Re: Implicit transactions
any opinions?

On Sep 21, 1:51 pm, Vladan Strigo <vla...@strigo.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Hornagold  
View profile  
 More options Sep 22 2009, 7:07 am
From: "Martin Hornagold" <Martin.Hornag...@marstangroup.com>
Date: Tue, 22 Sep 2009 12:07:49 +0100
Local: Tues, Sep 22 2009 7:07 am
Subject: RE: Implicit transactions
The simplest way of dealing with transactions in S#arp is to put the [Transaction] attribute on all action methods that contain database calls.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simone Busoli  
View profile  
 More options Sep 22 2009, 7:10 am
From: Simone Busoli <simone.bus...@gmail.com>
Date: Tue, 22 Sep 2009 13:10:01 +0200
Local: Tues, Sep 22 2009 7:10 am
Subject: Re: Implicit transactions

I think that transactions are a cross cutting concern, therefore they should
be tackled with AOP.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Cabanski  
View profile  
 More options Sep 22 2009, 7:38 am
From: Tom Cabanski <t...@cabanski.com>
Date: Tue, 22 Sep 2009 06:38:46 -0500
Local: Tues, Sep 22 2009 7:38 am
Subject: Re: Implicit transactions

Isn't the Transaction attribute in SharpArch exactly what you are talking
about?

--
Tom Cabanski
Vice President of Technology
Onpoint On Demand (Houston Office)
4801 Woodway Drive
Suite 300 East
Houston, TX 77056
Direct: 713-962-2638
http://www.onpointod.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kyle Baley  
View profile  
 More options Sep 22 2009, 8:54 am
From: Kyle Baley <k...@baley.org>
Date: Tue, 22 Sep 2009 08:54:26 -0400
Local: Tues, Sep 22 2009 8:54 am
Subject: Re: Implicit transactions

The transaction support is something that I think needs some love. At the
moment, transaction support is only at the controller level. I.e. you can't
make a service call transactional. Unless you call out to the DbContext
method on a repository which I think is a leaky abstraction. Even at the
controller level, you still need to manually rollback a database transaction
if anything goes wrong.

I like the idea of everything being transactional by default and maybe
explicitly specifying when you *don't* want to use one.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simone Busoli  
View profile  
 More options Sep 22 2009, 8:55 am
From: Simone Busoli <simone.bus...@gmail.com>
Date: Tue, 22 Sep 2009 14:55:37 +0200
Local: Tues, Sep 22 2009 8:55 am
Subject: Re: Implicit transactions

Kyle, this is easilly accomplished with windsor and interceptors.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kyle Baley  
View profile  
 More options Sep 22 2009, 9:00 am
From: Kyle Baley <k...@baley.org>
Date: Tue, 22 Sep 2009 09:00:07 -0400
Local: Tues, Sep 22 2009 9:00 am
Subject: Re: Implicit transactions

Which part? Making the service call transactional or making everything
transactional by default? In either case, is this something that should be
incorporated into S#arp?

On Tue, Sep 22, 2009 at 8:55 AM, Simone Busoli <simone.bus...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simone Busoli  
View profile  
 More options Sep 22 2009, 9:02 am
From: Simone Busoli <simone.bus...@gmail.com>
Date: Tue, 22 Sep 2009 15:02:00 +0200
Subject: Re: Implicit transactions

The first part. BTW, transaction boundaries should be, well, at the
boundaries, therefore on your controllers or web service endpoints.
WRT everything transactional by default I don't think it should be a part of
the project.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kyle Baley  
View profile  
 More options Sep 22 2009, 10:55 am
From: Kyle Baley <k...@baley.org>
Date: Tue, 22 Sep 2009 10:55:03 -0400
Local: Tues, Sep 22 2009 10:55 am
Subject: Re: Implicit transactions

That's a good point about it being at the boundaries. I can't think of an
example of where I'd like to make the service call transactional but not the
controller method.

Then again, are transactions typically part of the business rules? I.e. If
we want three things saved in a transaction, should it be closer to the
domain?

On Tue, Sep 22, 2009 at 9:02 AM, Simone Busoli <simone.bus...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simone Busoli  
View profile  
 More options Sep 22 2009, 11:47 am
From: Simone Busoli <simone.bus...@gmail.com>
Date: Tue, 22 Sep 2009 17:47:38 +0200
Local: Tues, Sep 22 2009 11:47 am
Subject: Re: Implicit transactions

I don't see them as part of the business rules, but at times there's
something that makes me think about transactions when I'm into the domain.
Not everything you are doing might be transactional, think about email
notifications.
If you need to confirm a user about its registration, you might:

- register the user, but fail to send the notification -> the transaction is
rolled back and nothing happens
- send the notification, but fail to save the user -> the transaction is
rolled back but the email has already been sent

I think an ideal way to manage these things is to have non transactional
resources behave like transactional ones. In the example above

- even if the notification fails, retry until it succeeds and therefore
don't rollback the transaction
- if the database save doesn't succeed, "undo" the send

this can be accomplished in several ways, of which I don't know which are
the best ones. Among them asynchronous messaging and out of process batch
operations.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kyle Baley  
View profile  
 More options Sep 22 2009, 2:43 pm
From: Kyle Baley <k...@baley.org>
Date: Tue, 22 Sep 2009 14:43:13 -0400
Local: Tues, Sep 22 2009 2:43 pm
Subject: Re: Implicit transactions

Yeah, we need to think of transactions as more than a database operation.
Manipulating a file is another example.

On Tue, Sep 22, 2009 at 11:47 AM, Simone Busoli <simone.bus...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank  
View profile  
 More options Sep 22 2009, 4:20 pm
From: Frank <frank.l...@gmail.com>
Date: Tue, 22 Sep 2009 13:20:02 -0700 (PDT)
Local: Tues, Sep 22 2009 4:20 pm
Subject: Re: Implicit transactions
I've run across this exact same scenario and my solution was to use
the System.TransactionScope to wrap the database and email interaction
across one distributed transaction. I believe that
System.TransactionScope uses MSDTC under the hood, which coordinates
with database and non-database resources alike, such as an smtp
server.

I've pondered the idea of extending the [Transaction] attribute so
that it uses TransactionScope instead of just the NHibernate one. If
I'm not mistaken, an ADO.NET connection will automatically work within
the context of an MSDTC transaction...

On Sep 22, 8:47 am, Simone Busoli <simone.bus...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simone Busoli  
View profile  
 More options Sep 22 2009, 4:42 pm
From: Simone Busoli <simone.bus...@gmail.com>
Date: Tue, 22 Sep 2009 22:42:11 +0200
Local: Tues, Sep 22 2009 4:42 pm
Subject: Re: Implicit transactions
I never used the DTC, I don't know how well it could work. I guess it
imposes several constraints about how your system is layed out.

2009/9/22, Frank <frank.l...@gmail.com>:

--
Inviato dal mio dispositivo mobile

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kyle Baley  
View profile  
 More options Sep 22 2009, 9:20 pm
From: Kyle Baley <k...@baley.org>
Date: Tue, 22 Sep 2009 21:20:02 -0400
Local: Tues, Sep 22 2009 9:20 pm
Subject: Re: Implicit transactions

I've used it with Oracle and ADO.NET and it requires other dependencies.
Doesn't work out of the box like it does against a SQL Server database.

On Tue, Sep 22, 2009 at 4:42 PM, Simone Busoli <simone.bus...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »