Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspdotnet_website_programming thread: C# syntax question


Message #1 by john@j... on Mon, 2 Dec 2002 00:17:14
Can someone help me understand the following C# syntax?  This is from the 
bottom of p. 39 in the book (ASP.NET Website Programming Problem-Design-
Solution).

Here's the code:

namespace Wrox.WebModules.ServicedSample
{
	using System;
	using System.EnterpriseServices;
	using System.Data;

	[Transaction(TransactionOption.Supported)]

	{snip}

My question centers around the "[Transaction
(TransactionOption.Supported)]" statement.

QUESTIONS:
1. Is this setting some sort of property?
2. If so, what object is it setting a property for?
3. Is there an equivalent VB.NET syntax for this?
4. When is it necessary/useful to use this syntax?

Thanks,
John
Message #2 by "Jerry Lanphear" <jerrylan@q...> on Sun, 1 Dec 2002 18:21:56 -0700
John,


This has to do with COM+ DTS and enabling transactions at the assembly
level.  Transactions have to do with events which must occur in a
certain order and all much be OK or else the whole bunch of them are
thrown out.  For instance, an online purchase requires a selection of an
item, a confirmation that the item is in stock, an acceptance of the
price, a confirmation that the customer has the credit card
authorization and a confirmation that the customer has the final
receipt.  If any of these fail, then the whole thing must be reversed.  

The different properties for TransactionOption are Disabled,
NotSupported, Supported, Required and RequiresNew.

The code you see specifies that the namespace in the assembly provides
transactional support.  It appears before any classes are defined in the
namespace.

I shall endevour to translate the program into VB.NET for you

namespace Wrox.WebModules.ServicedSample
	
	Imports System;
	Imports System.EnterpriseServices;
	Imports System.Data;

	<Transaction(TransactionOption.Supported)>

	snip

Here's a URL to a nice article from the MSDN library which can give you
more to chew on about DTS and VB.NET.

Regards,
Jerry
-----Original Message-----
From: john@j... [mailto:john@j...] 
Sent: Monday, December 02, 2002 12:17 AM
To: Website Programming with ASP.NET
Subject: [aspdotnet_website_programming] C# syntax question

Can someone help me understand the following C# syntax?  This is from
the 
bottom of p. 39 in the book (ASP.NET Website Programming Problem-Design-
Solution).

Here's the code:

namespace Wrox.WebModules.ServicedSample
{
	using System;
	using System.EnterpriseServices;
	using System.Data;

	[Transaction(TransactionOption.Supported)]

	{snip}

My question centers around the "[Transaction
(TransactionOption.Supported)]" statement.

QUESTIONS:
1. Is this setting some sort of property?
2. If so, what object is it setting a property for?
3. Is there an equivalent VB.NET syntax for this?
4. When is it necessary/useful to use this syntax?

Thanks,
John
---
Professional Design Patterns in VB.NET: 
Building Adaptable Applications

Want to know how design patterns bring reusable 
design and adaptabilty to your applications? How 
to recognize the need for a design pattern 
solution? How to select, design, and implement 
the right patterns? How parts of the .NET Framework 
(like the .NET Data Providers and .NET Remoting) 
take advantage of design patterns? This book 
presents a practical approach to using design 
patterns in VB.NET, by focusing on the relevance 
of design patterns in the different tiers of a 
distributed n-tier architecture. 

http://www.wrox.com/books/1861006985.htm




Message #3 by john@j... on Mon, 2 Dec 2002 03:10:10
Thanks for the explanation.  I would like to read the article, but I think 
you forgot to post the URL.  Could you post that for me please?

Thanks,
John
Message #4 by "Jerry Lanphear" <jerrylan@q...> on Sun, 1 Dec 2002 21:39:41 -0700
I did forget to post the URL!
I guess, just like I forgot to take the semicolons out for VB.NET

For that you get two for one. Enjoy.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/ht
ml/disttranvbnet.asp

http://msdn.microsoft.com/msdnmag/issues/02/05/Basics/default.aspx

Jerry
----- Original Message -----
From: <john@j...>
To: "Website Programming with ASP.NET"
<aspdotnet_website_programming@p...>
Sent: Monday, December 02, 2002 3:10 AM
Subject: [aspdotnet_website_programming] RE: C# syntax question


> Thanks for the explanation.  I would like to read the article, but I think
> you forgot to post the URL.  Could you post that for me please?
>
> Thanks,
> John
> ---
> Professional Design Patterns in VB.NET:
> Building Adaptable Applications
>
> Want to know how design patterns bring reusable
> design and adaptabilty to your applications? How
> to recognize the need for a design pattern
> solution? How to select, design, and implement
> the right patterns? How parts of the .NET Framework
> (like the .NET Data Providers and .NET Remoting)
> take advantage of design patterns? This book
> presents a practical approach to using design
> patterns in VB.NET, by focusing on the relevance
> of design patterns in the different tiers of a
> distributed n-tier architecture.
>
> http://www.wrox.com/books/1861006985.htm
>
>
>

Message #5 by john@j... on Mon, 2 Dec 2002 16:55:05
Thanks Jerry,

A quick question regarding .NET and COM+.  I noticed in the MSDN Magazine 
article that the transactional component was not registered under COM+ (at 
least they skipped that step anyway in the example).  Is this not 
necessary with .NET now?

Thanks,
John

________________________________

For that you get two for one. Enjoy.

http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dndotnet/ht
ml/disttranvbnet.asp

http://msdn.microsoft.com/msdnmag/issues/02/05/Basics/default.aspx

Jerry

  Return to Index