Wrox Programmer Forums
|
BOOK: Professional WCF Programming: .NET Dev with Windows Communication Found ISBN: 9780470089842
This is the forum to discuss the Wrox book Professional WCF Programming: .NET Development with the Windows Communication Foundation by Scott Klein; ISBN: 9780470089842
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional WCF Programming: .NET Dev with Windows Communication Found ISBN: 9780470089842 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 20th, 2007, 11:30 AM
Authorized User
 
Join Date: Dec 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8 - Transactions

Scott,

I read Chapter 8 fully and I understand what is written as far as transactions are concerned. What I am confused about is how a rollback is called. Also, what code needs to be written to get acknowledgement of the rollback so the rollback can occur.

In addition, how do you "bundle" multiple client calls into a transaction or are transactions only within a specific Operation on the server side?

Thanks

 
Old December 25th, 2007, 09:04 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Hi jamocle,

I am finishing up the Message contract example in chapter 6 currently and will answer this by the end of the week.

Thanks...

Scott

========================
Scott Klein
Author of:
Professional SQL Server 2005 XML
Professional WCF Programming: .NET Development with the Windows Communication Foundation
Professional LINQ
========================
 
Old January 4th, 2008, 06:07 PM
Authorized User
 
Join Date: Dec 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Scott,

Any information on this one yet?

 
Old January 11th, 2008, 12:38 PM
Authorized User
 
Join Date: Dec 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Scott,
Any information on this yet?

Thanks

James

 
Old January 11th, 2008, 01:52 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Oops! I completely forgot about this! I will look at this right now and get back to you.

========================
Scott Klein
Author of:
Professional SQL Server 2005 XML
Professional WCF Programming: .NET Development with the Windows Communication Foundation
Professional LINQ
========================
 
Old January 14th, 2008, 09:55 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

OK, here is what I found. Just for clarification I spoke with WCF transaction person, and got the following feedback:

If the transaction is not complete (you have some methods with TransactionAutoComplete=false which is not the default) AND you terminate the session by calling an IsTerminating method, the transaction will Commit. Rollback will typically occur when exceptions happen (user or system).


To receive transaction notifications, take a look at the IEnlistmentNotification interface (http://msdn2.microsoft.com/en-us/lib...ification.aspx).

Then at EnlistVolatile (http://msdn2.microsoft.com/en-us/lib...tvolatile.aspx) for examples of how to do this.

Basically what will happen is you’ll register a class which will receive various transaction messages (prepare, commit, rollback) and you’ll be expected to handle those notifications correctly. (Transaction.Current.EnlistVolatile(new MyNotificationClass(), EnlistmentOptions.None))



========================
Scott Klein
Author of:
Professional SQL Server 2005 XML
Professional WCF Programming: .NET Development with the Windows Communication Foundation
Professional LINQ
========================
 
Old February 10th, 2008, 12:56 PM
Authorized User
 
Join Date: Dec 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Scott,

I performed the EnlistVolatile along with the IEnlistmentNotification interface. When I turn off Transactions in WCF I get the prepare, commit, rollback, etc, but I, of course do not get information flowed back to the client.

When I turn on Transaction flowing all I get is the rollback, no commit or prepare. It looks like WCF enlists prior to me being able to prepare which is killing my ability to write server side transactions.

Help please!!!

Jamocle


 
Old February 14th, 2008, 10:32 AM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Hi Jamocle,

Sorry for the late reply. I will look into this today and get back with you (I am not in the office right now) but I will reply within the next 24 hours.

========================
Scott Klein
Author of:
Professional SQL Server 2005 XML
Professional WCF Programming: .NET Development with the Windows Communication Foundation
Professional LINQ
========================
 
Old February 22nd, 2008, 12:40 PM
Authorized User
 
Join Date: Dec 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Scott,

Any news yet? I am anxiously awaiting.

 
Old February 25th, 2008, 10:05 AM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

The EnlistVolatile has two overloads, one which supports a two phase commit and another which supports a single phase commit. The IEnlistmenetNotification enlists a volatile resource that supports a two phase commit transaction. You should be able to do something like:

using (TransactionScope scope = new TransactionScope())
{

  //Create an enlistment object
  myEnlistmentClass myElistment = new myEnlistmentClass();

  //Enlist on the current transaction with the enlistment object
  Transaction.Current.EnlistVolatile(myElistment, EnlistmentOptions.None);

  //Perform transactional work here.

  //Call complete on the TransactionScope based on console input
  ConsoleKeyInfo c;
  while(true)
  {
    Console.Write("Complete the transaction scope? [Y|N] ");
    c = Console.ReadKey();
    Console.WriteLine();
    if ((c.KeyChar == 'Y') || (c.KeyChar == 'y'))
    {
      scope.Complete();
      break;
    }
    else if ((c.KeyChar == 'N') || (c.KeyChar == 'n'))
    {
      break;
    }
  }
}

It also depends on now you implement transactions, meaning, in some cases you need to commit/rollback manually. I need to go look, but I think this chapter covers that...i'll grab a copy of my book and look.

Also, you may need to look at the EnlistDurable method, which let's you get a durable enlistment in a transaction.

I'll repost shortly after I verify a few things...


========================
Scott Klein
Author of:
Professional SQL Server 2005 XML
Professional WCF Programming: .NET Development with the Windows Communication Foundation
Professional LINQ
========================





Similar Threads
Thread Thread Starter Forum Replies Last Post
Transactions???? CRONER BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 February 4th, 2009 04:43 PM
Asynchronous Transactions jroxit Other Programming Languages 0 July 29th, 2008 11:12 AM
transactions.... Johnslg BOOK: Expert SQL Server 2005 Integration Services ISBN: 978-0-470-13411-5 0 August 20th, 2007 08:51 AM
Chapter 3 - Transactions PedroPN BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 December 1st, 2006 07:42 PM
Postgresql Transactions satyr Pro JSP 0 March 23rd, 2006 08:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.