SlideShare a Scribd company logo
1 of 22
www.orbitone.com
Raas van Gaverestraat 83
B-9000 GENT, Belgium
E-mail info@orbitone.com
Website www.orbitone.com
Tel. +32 9 265 74 20
Fax +32 9 265 74 10
VAT BE 456.457.353
Bank 442-7059001-50 (KBC)
27 April, 2009 WCF Transactions
by Tom Pester
27 April, 2009
WCF Transactions, by Tom Pester2
ACID
Transactions must have the ACID properties.
ACID stands for:
o Atomic
o Consistent
o Isolated
o Durable
27 April, 2009
WCF Transactions, by Tom Pester3
Two-phase commit protocol
Phase 1
The coordinator asks each resource manager to prepare to commit.
Each resource manager responds (votes) to commit or abort the
transaction.
The coordinator collects all votes and makes a decision to commit or
abort the entire transaction.
27 April, 2009
WCF Transactions, by Tom Pester4
Two-phase commit protocol
Phase 2
The coordinator asks each resource manager to commit or abort
based on this decision.
If the resource manager is asked to commit, it acknowledges
completion of the activity. If asked to abort, it rolls back the activity.
The coordinator waits for acknowledgment from all resource
managers that the transaction was successfully committed.
27 April, 2009
WCF Transactions, by Tom Pester5
TransactionScope
using (TransactionScope scope = new TransactionScope( ))
{
Operation1( );
Operation2( );
scope.Complete( );
}
27 April, 2009
WCF Transactions, by Tom Pester6
Lightweight Transaction Manager
 Any number of volatile resource managers
can be enlisted.
 Only a single durable resource manager can
be enlisted.
 No application domain or process boundaries
can be crossed.
27 April, 2009
WCF Transactions, by Tom Pester7
Kernel Transaction Manager
 Windows Vista introduced the Kernel
Transaction Manager (KTM) to manage the
resource managers associated with its
Transactional Registry (TxR) and its transaction
filesystem, called Transactional NTFS (TxF).
 When the downstream code within a
TransactionScope enlists one of these
resource managers, the LTM is promoted to
KTM automatically.
o Any number of volatile resource managers can
be enlisted.
o Only a single durable or kernel resource
manager can be enlisted.
o No application domain or process boundaries
can be crossed.
27 April, 2009
WCF Transactions, by Tom Pester8
Distributed Transaction Coordinator
o An application, process, or machine boundary is
crossed.
o More than one durable resource manager is
enlisted
27 April, 2009
WCF Transactions, by Tom Pester9
WS-AtomicTransaction and WS-Coordination
protocols
 WS-AtomicTransaction (WS-AT) and WS-Coordination (WS-COOR) are
interoperable protocols that enable message-based distributed transactions
over HTTP and across platform boundaries
27 April, 2009
WCF Transactions, by Tom Pester10
Enabling WS-AT
27 April, 2009
WCF Transactions, by Tom Pester11
Regasm.exe /codebase wsatui.dll
27 April, 2009
WCF Transactions, by Tom Pester12
Transactions and System Tiers
27 April, 2009
WCF Transactions, by Tom Pester13
Configuring WCF Transactions
Transaction flow between clients and services is a function of
othe binding configuration,
othe service contract requirements
oand the behavior of the service operation being invoked.
27 April, 2009
WCF Transactions, by Tom Pester14
Enabling transaction flow
 For a client transaction to flow across a service boundary, the binding must
support transaction flow, which immediately limits you to one of these
standard bindings: NetNamedPipeBinding
oNetTcpBinding
oWSHttpBinding,
oWSDualHttpBinding
oand WSFederationHttpBinding.
<wsHttpBinding>
<binding name="wsHttpTxTransactionFlow="true" />
</wsHttpBinding>
27 April, 2009
WCF Transactions, by Tom Pester15
Transaction flow options
The TransactionFlowAttribute
oNotAllowed
oMandatory
oAllowed
[ServiceContract()]
public interface ICountersService
{
[OperationContract]
[TransactionFlow(TransactionFlowOption.Allowed)]
void ResetCounters( );
27 April, 2009
WCF Transactions, by Tom Pester16
Service operations and transactions
 Although the TransactionFlowOption does influence the presence of a client
transaction, it does not guarantee that a service operation will use the
transaction.
 In the implementation of a service contract, each operation must opt-in to
support transactions. TransactionScopeRequired property of the
OperationBehaviorAttribute
[OperationBehavior(TransactionScopeRequired=true)]
public void ResetCounters( )
{...}
27 April, 2009
WCF Transactions, by Tom Pester17
TransactionScopeRequired
 When set to false, which is the default setting, the service will never join a
client transaction, nor will it automatically create a new transaction. That
means that if the service code requires a transaction, it would have to do so
manually using a TransactionScope block.
 When set to true, if a client transaction is flowed to the service, the service
operation will join that transaction. If a client transaction is not flowed, a
new transaction is created for the service operation to execute in.
27 April, 2009
WCF Transactions, by Tom Pester18
DistributedIdentifier
 An indicator that the service is participating in the client transaction is when
the DistributedIdentifier of the current transaction is set:
 Transaction.Current.TransactionInformation.DistributedIdentifier
27 April, 2009
WCF Transactions, by Tom Pester19
TransactionAutoComplete
 Another property of the OperationBehaviorAttribute that affects how
transactions are handled is the TransactionAutoComplete property. By
default, this property is set to true, which means that the consistency bit is
set to true automatically if no exceptions are thrown

[OperationBehavior(TransactionScopeRequired=true,TransactionAutoCompl
ete=false)]
27 April, 2009
WCF Transactions, by Tom Pester20
Controlling IsolationLevel
 The System.Transactions namespace defines an IsolationLevel enumeration that defines
the following isolation options
o Chaos
o ReadCommitted
o ReadUncommitted
o RepeatableRead
o Serializable
o Snapshot
o Unspecified
 The last of these settings, Unspecified, is the default.
27 April, 2009
WCF Transactions, by Tom Pester21
TransactionOptions
TransactionOptions options = new TransactionOptions( );options.IsolationLevel =
IsolationLevel.Serializable;
using (TransactionScope scope = new
TransactionScope(TransactionScopeOption.Required, options))
{
m_proxy.SetCounter1(int.Parse(this.txtCounter.Text));
m_proxy.SetCounter2(int.Parse(this.txtCounter.Text));
scope.Complete( );
}
www.orbitone.com
22 WCF Transactions, by Tom Pester
27 April, 2009

More Related Content

Viewers also liked

Community Narrative
Community NarrativeCommunity Narrative
Community Narrative
lettingtonm
 
Citrex610 l-en-spa 3 citrex directo en alimentos(2)
Citrex610 l-en-spa 3 citrex directo en alimentos(2)Citrex610 l-en-spa 3 citrex directo en alimentos(2)
Citrex610 l-en-spa 3 citrex directo en alimentos(2)
CITREX
 
productronica 2013 Tageszeitung Tag 1 / daily newspaper day 1
productronica 2013 Tageszeitung Tag 1 / daily newspaper day 1productronica 2013 Tageszeitung Tag 1 / daily newspaper day 1
productronica 2013 Tageszeitung Tag 1 / daily newspaper day 1
Messe München GmbH
 
Fidesys [Web Ready 2010]
Fidesys [Web Ready 2010]Fidesys [Web Ready 2010]
Fidesys [Web Ready 2010]
Ingria. Technopark St. Petersburg
 
Thematic Unit Story Board
Thematic Unit Story BoardThematic Unit Story Board
Thematic Unit Story Board
Amcconnell
 
Зачем нужен маркетинг
Зачем нужен маркетингЗачем нужен маркетинг
Зачем нужен маркетинг
Vadim Zhartun
 

Viewers also liked (20)

Crocodile!
Crocodile!Crocodile!
Crocodile!
 
African buffalo
African buffaloAfrican buffalo
African buffalo
 
Community Narrative
Community NarrativeCommunity Narrative
Community Narrative
 
Фото
ФотоФото
Фото
 
Next Generation Media Quarterly April 2011
Next Generation Media Quarterly April 2011Next Generation Media Quarterly April 2011
Next Generation Media Quarterly April 2011
 
Грязные приёмы жестких переговоров
Грязные приёмы жестких переговоровГрязные приёмы жестких переговоров
Грязные приёмы жестких переговоров
 
How Not to Fail at Social Media
How Not to Fail at Social MediaHow Not to Fail at Social Media
How Not to Fail at Social Media
 
Smart Method Kids Taekwondo graduation 2013
Smart Method Kids Taekwondo graduation 2013Smart Method Kids Taekwondo graduation 2013
Smart Method Kids Taekwondo graduation 2013
 
Camp Manitou
Camp ManitouCamp Manitou
Camp Manitou
 
Citrex610 l-en-spa 3 citrex directo en alimentos(2)
Citrex610 l-en-spa 3 citrex directo en alimentos(2)Citrex610 l-en-spa 3 citrex directo en alimentos(2)
Citrex610 l-en-spa 3 citrex directo en alimentos(2)
 
productronica 2013 Tageszeitung Tag 1 / daily newspaper day 1
productronica 2013 Tageszeitung Tag 1 / daily newspaper day 1productronica 2013 Tageszeitung Tag 1 / daily newspaper day 1
productronica 2013 Tageszeitung Tag 1 / daily newspaper day 1
 
Sfare cafe testing web applications
Sfare cafe testing web applicationsSfare cafe testing web applications
Sfare cafe testing web applications
 
Развитие инновационных экосистем_компендиум
Развитие инновационных экосистем_компендиумРазвитие инновационных экосистем_компендиум
Развитие инновационных экосистем_компендиум
 
Fidesys [Web Ready 2010]
Fidesys [Web Ready 2010]Fidesys [Web Ready 2010]
Fidesys [Web Ready 2010]
 
Информационный вестник Март 2012
Информационный вестник Март 2012Информационный вестник Март 2012
Информационный вестник Март 2012
 
Трансфер технологий в вузах_глобализация академических инноваций, Т. Поспелова
Трансфер технологий в вузах_глобализация академических инноваций, Т. Поспелова Трансфер технологий в вузах_глобализация академических инноваций, Т. Поспелова
Трансфер технологий в вузах_глобализация академических инноваций, Т. Поспелова
 
The hippopotamus
The hippopotamusThe hippopotamus
The hippopotamus
 
Thematic Unit Story Board
Thematic Unit Story BoardThematic Unit Story Board
Thematic Unit Story Board
 
Inbound Marketing - Promotion
Inbound Marketing - PromotionInbound Marketing - Promotion
Inbound Marketing - Promotion
 
Зачем нужен маркетинг
Зачем нужен маркетингЗачем нужен маркетинг
Зачем нужен маркетинг
 

Similar to WCF Transactions

Topic2 Understanding Middleware
Topic2 Understanding MiddlewareTopic2 Understanding Middleware
Topic2 Understanding Middleware
sanjoysanyal
 
Tradedog Arbitrum Crypto Project Report.pdf
Tradedog Arbitrum Crypto Project Report.pdfTradedog Arbitrum Crypto Project Report.pdf
Tradedog Arbitrum Crypto Project Report.pdf
Tradedog
 

Similar to WCF Transactions (20)

Wcf Transaction Handling
Wcf Transaction HandlingWcf Transaction Handling
Wcf Transaction Handling
 
Managing transactions 11g release 1 (10.3
Managing transactions   11g release 1 (10.3Managing transactions   11g release 1 (10.3
Managing transactions 11g release 1 (10.3
 
transaction management, concept & State
transaction management, concept & Statetransaction management, concept & State
transaction management, concept & State
 
Topic2 Understanding Middleware
Topic2 Understanding MiddlewareTopic2 Understanding Middleware
Topic2 Understanding Middleware
 
Empty Container Relocation: Businesscase
Empty Container Relocation: Businesscase Empty Container Relocation: Businesscase
Empty Container Relocation: Businesscase
 
Qtum How To Make EVM Run On UTXO Model - Patrick Dai
Qtum How To Make EVM Run On UTXO Model - Patrick DaiQtum How To Make EVM Run On UTXO Model - Patrick Dai
Qtum How To Make EVM Run On UTXO Model - Patrick Dai
 
Istio Triangle Kubernetes Meetup Aug 2019
Istio Triangle Kubernetes Meetup Aug 2019Istio Triangle Kubernetes Meetup Aug 2019
Istio Triangle Kubernetes Meetup Aug 2019
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit Protocols
 
Control Transactions using PowerCenter
Control Transactions using PowerCenterControl Transactions using PowerCenter
Control Transactions using PowerCenter
 
DataArt Innovation Showcase Blockchain Billing
DataArt Innovation Showcase Blockchain BillingDataArt Innovation Showcase Blockchain Billing
DataArt Innovation Showcase Blockchain Billing
 
Trail of Bits Audit for Origin Protocol
Trail of Bits Audit for Origin ProtocolTrail of Bits Audit for Origin Protocol
Trail of Bits Audit for Origin Protocol
 
Horizon: A Gas-Efficient Trustless Bridge for Cross-Chain Transactions
Horizon: A Gas-Efficient Trustless Bridge for Cross-Chain TransactionsHorizon: A Gas-Efficient Trustless Bridge for Cross-Chain Transactions
Horizon: A Gas-Efficient Trustless Bridge for Cross-Chain Transactions
 
LINE+LINK-DEV 2018 - ICON’s Interchain Technology and Developer Tools
LINE+LINK-DEV 2018 - ICON’s Interchain Technology and Developer ToolsLINE+LINK-DEV 2018 - ICON’s Interchain Technology and Developer Tools
LINE+LINK-DEV 2018 - ICON’s Interchain Technology and Developer Tools
 
3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query
 
Managing microservices with Istio Service Mesh
Managing microservices with Istio Service MeshManaging microservices with Istio Service Mesh
Managing microservices with Istio Service Mesh
 
Transactional OSGi Applications Done Right
Transactional OSGi Applications Done RightTransactional OSGi Applications Done Right
Transactional OSGi Applications Done Right
 
Tradedog Arbitrum Crypto Project Report.pdf
Tradedog Arbitrum Crypto Project Report.pdfTradedog Arbitrum Crypto Project Report.pdf
Tradedog Arbitrum Crypto Project Report.pdf
 
Ambisafe smart contracts audit
Ambisafe smart contracts auditAmbisafe smart contracts audit
Ambisafe smart contracts audit
 
E recon
E reconE recon
E recon
 
112/2009 1-
112/2009 1-112/2009 1-
112/2009 1-
 

More from Orbit One - We create coherence

More from Orbit One - We create coherence (20)

ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...
ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...
ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...
 
HoGent tips and tricks van een self-made ondernemer
HoGent tips and tricks van een self-made ondernemer HoGent tips and tricks van een self-made ondernemer
HoGent tips and tricks van een self-made ondernemer
 
Het Nieuwe Werken in de praktijk
Het Nieuwe Werkenin de praktijkHet Nieuwe Werkenin de praktijk
Het Nieuwe Werken in de praktijk
 
ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...
ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...
ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...
 
ShareCafé 3 - Geef je samenwerking een technologische upgrade
ShareCafé 3 - Geef je samenwerking een technologische upgradeShareCafé 3 - Geef je samenwerking een technologische upgrade
ShareCafé 3 - Geef je samenwerking een technologische upgrade
 
ShareCafé 2 - Werk slimmer door geïntegreerde tools
ShareCafé 2 - Werk slimmer door geïntegreerde toolsShareCafé 2 - Werk slimmer door geïntegreerde tools
ShareCafé 2 - Werk slimmer door geïntegreerde tools
 
ShareCafé 1: Hou de Nieuwe Werker gemotiveerd
ShareCafé 1: Hou de Nieuwe Werker gemotiveerdShareCafé 1: Hou de Nieuwe Werker gemotiveerd
ShareCafé 1: Hou de Nieuwe Werker gemotiveerd
 
Business value of Lync integrations
Business value of Lync integrationsBusiness value of Lync integrations
Business value of Lync integrations
 
OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...
OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...
OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...
 
Identity in the cloud using Microsoft
Identity in the cloud using MicrosoftIdentity in the cloud using Microsoft
Identity in the cloud using Microsoft
 
OneCafé: The future of membership organizations facilitated by CRM and collab...
OneCafé: The future of membership organizations facilitated by CRM and collab...OneCafé: The future of membership organizations facilitated by CRM and collab...
OneCafé: The future of membership organizations facilitated by CRM and collab...
 
OneCafé: The new world of work and your organisation
OneCafé: The new world of work and your organisationOneCafé: The new world of work and your organisation
OneCafé: The new world of work and your organisation
 
Social Computing in your organization using SharePoint: challenges and benefits
Social Computing in your organization using SharePoint: challenges and benefitsSocial Computing in your organization using SharePoint: challenges and benefits
Social Computing in your organization using SharePoint: challenges and benefits
 
Windows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best PracticesWindows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best Practices
 
Wie is Orbit One Internet Solutions
Wie is Orbit One Internet SolutionsWie is Orbit One Internet Solutions
Wie is Orbit One Internet Solutions
 
Azure Umbraco workshop
Azure Umbraco workshopAzure Umbraco workshop
Azure Umbraco workshop
 
Marketing Automation in Dynamics CRM with ClickDimensions
Marketing Automation in Dynamics CRM with ClickDimensionsMarketing Automation in Dynamics CRM with ClickDimensions
Marketing Automation in Dynamics CRM with ClickDimensions
 
Office 365, is cloud right for your company?
Office 365, is cloud right for your company?Office 365, is cloud right for your company?
Office 365, is cloud right for your company?
 
Who is Orbit One internet solutions?
Who is Orbit One internet solutions?Who is Orbit One internet solutions?
Who is Orbit One internet solutions?
 
Azure and Umbraco CMS
Azure and Umbraco CMSAzure and Umbraco CMS
Azure and Umbraco CMS
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

WCF Transactions

  • 1. www.orbitone.com Raas van Gaverestraat 83 B-9000 GENT, Belgium E-mail info@orbitone.com Website www.orbitone.com Tel. +32 9 265 74 20 Fax +32 9 265 74 10 VAT BE 456.457.353 Bank 442-7059001-50 (KBC) 27 April, 2009 WCF Transactions by Tom Pester
  • 2. 27 April, 2009 WCF Transactions, by Tom Pester2 ACID Transactions must have the ACID properties. ACID stands for: o Atomic o Consistent o Isolated o Durable
  • 3. 27 April, 2009 WCF Transactions, by Tom Pester3 Two-phase commit protocol Phase 1 The coordinator asks each resource manager to prepare to commit. Each resource manager responds (votes) to commit or abort the transaction. The coordinator collects all votes and makes a decision to commit or abort the entire transaction.
  • 4. 27 April, 2009 WCF Transactions, by Tom Pester4 Two-phase commit protocol Phase 2 The coordinator asks each resource manager to commit or abort based on this decision. If the resource manager is asked to commit, it acknowledges completion of the activity. If asked to abort, it rolls back the activity. The coordinator waits for acknowledgment from all resource managers that the transaction was successfully committed.
  • 5. 27 April, 2009 WCF Transactions, by Tom Pester5 TransactionScope using (TransactionScope scope = new TransactionScope( )) { Operation1( ); Operation2( ); scope.Complete( ); }
  • 6. 27 April, 2009 WCF Transactions, by Tom Pester6 Lightweight Transaction Manager  Any number of volatile resource managers can be enlisted.  Only a single durable resource manager can be enlisted.  No application domain or process boundaries can be crossed.
  • 7. 27 April, 2009 WCF Transactions, by Tom Pester7 Kernel Transaction Manager  Windows Vista introduced the Kernel Transaction Manager (KTM) to manage the resource managers associated with its Transactional Registry (TxR) and its transaction filesystem, called Transactional NTFS (TxF).  When the downstream code within a TransactionScope enlists one of these resource managers, the LTM is promoted to KTM automatically. o Any number of volatile resource managers can be enlisted. o Only a single durable or kernel resource manager can be enlisted. o No application domain or process boundaries can be crossed.
  • 8. 27 April, 2009 WCF Transactions, by Tom Pester8 Distributed Transaction Coordinator o An application, process, or machine boundary is crossed. o More than one durable resource manager is enlisted
  • 9. 27 April, 2009 WCF Transactions, by Tom Pester9 WS-AtomicTransaction and WS-Coordination protocols  WS-AtomicTransaction (WS-AT) and WS-Coordination (WS-COOR) are interoperable protocols that enable message-based distributed transactions over HTTP and across platform boundaries
  • 10. 27 April, 2009 WCF Transactions, by Tom Pester10 Enabling WS-AT
  • 11. 27 April, 2009 WCF Transactions, by Tom Pester11 Regasm.exe /codebase wsatui.dll
  • 12. 27 April, 2009 WCF Transactions, by Tom Pester12 Transactions and System Tiers
  • 13. 27 April, 2009 WCF Transactions, by Tom Pester13 Configuring WCF Transactions Transaction flow between clients and services is a function of othe binding configuration, othe service contract requirements oand the behavior of the service operation being invoked.
  • 14. 27 April, 2009 WCF Transactions, by Tom Pester14 Enabling transaction flow  For a client transaction to flow across a service boundary, the binding must support transaction flow, which immediately limits you to one of these standard bindings: NetNamedPipeBinding oNetTcpBinding oWSHttpBinding, oWSDualHttpBinding oand WSFederationHttpBinding. <wsHttpBinding> <binding name="wsHttpTxTransactionFlow="true" /> </wsHttpBinding>
  • 15. 27 April, 2009 WCF Transactions, by Tom Pester15 Transaction flow options The TransactionFlowAttribute oNotAllowed oMandatory oAllowed [ServiceContract()] public interface ICountersService { [OperationContract] [TransactionFlow(TransactionFlowOption.Allowed)] void ResetCounters( );
  • 16. 27 April, 2009 WCF Transactions, by Tom Pester16 Service operations and transactions  Although the TransactionFlowOption does influence the presence of a client transaction, it does not guarantee that a service operation will use the transaction.  In the implementation of a service contract, each operation must opt-in to support transactions. TransactionScopeRequired property of the OperationBehaviorAttribute [OperationBehavior(TransactionScopeRequired=true)] public void ResetCounters( ) {...}
  • 17. 27 April, 2009 WCF Transactions, by Tom Pester17 TransactionScopeRequired  When set to false, which is the default setting, the service will never join a client transaction, nor will it automatically create a new transaction. That means that if the service code requires a transaction, it would have to do so manually using a TransactionScope block.  When set to true, if a client transaction is flowed to the service, the service operation will join that transaction. If a client transaction is not flowed, a new transaction is created for the service operation to execute in.
  • 18. 27 April, 2009 WCF Transactions, by Tom Pester18 DistributedIdentifier  An indicator that the service is participating in the client transaction is when the DistributedIdentifier of the current transaction is set:  Transaction.Current.TransactionInformation.DistributedIdentifier
  • 19. 27 April, 2009 WCF Transactions, by Tom Pester19 TransactionAutoComplete  Another property of the OperationBehaviorAttribute that affects how transactions are handled is the TransactionAutoComplete property. By default, this property is set to true, which means that the consistency bit is set to true automatically if no exceptions are thrown  [OperationBehavior(TransactionScopeRequired=true,TransactionAutoCompl ete=false)]
  • 20. 27 April, 2009 WCF Transactions, by Tom Pester20 Controlling IsolationLevel  The System.Transactions namespace defines an IsolationLevel enumeration that defines the following isolation options o Chaos o ReadCommitted o ReadUncommitted o RepeatableRead o Serializable o Snapshot o Unspecified  The last of these settings, Unspecified, is the default.
  • 21. 27 April, 2009 WCF Transactions, by Tom Pester21 TransactionOptions TransactionOptions options = new TransactionOptions( );options.IsolationLevel = IsolationLevel.Serializable; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { m_proxy.SetCounter1(int.Parse(this.txtCounter.Text)); m_proxy.SetCounter2(int.Parse(this.txtCounter.Text)); scope.Complete( ); }
  • 22. www.orbitone.com 22 WCF Transactions, by Tom Pester 27 April, 2009

Editor's Notes

  1. Transactions are necessary when two or more activities must be coordinated as a single operation, ensuring that the system is always left in a consistent state. The only two viable options are to complete all activities successfully or to leave the system as it was before initiating either activity.
  2. The System.Transactions namespace is introduced with the .NET Framework 2.0 By default, what this block of code does is construct a new transaction, or join an existing transaction if one already exists by an upstream caller.
  3. The Microsoft Distributed Transaction Coordinator (DTC) is a transaction manager that is able to coordinate resource managers that span application domain, process, and machine boundaries on the same network. With .NET 2.0, the LTM will first promote to KTM based on the conditions discussed in the previous section but will promote to DTC if any of the following conditions are met:
  4. Configure DTC Security Click Start, click Run, type dcomcnfg and then click OK to open Component Services. Enable Network DTC Access. For the most secure results, enable mutual authentication for inbound or outbound communication. For testing purposes, you may disable authentication initially. If authentication is required, certificates must be configured for WS-AT
  5. 2. Then, from the WS-AT tab of the DTC Enable WS-AtomicTransaction network support. First, you must add the snap-in using the following command-line instruction: Regasm.exe /codebase wsatui.dll C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Regasm.exe /codebase "c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\wsatui.dll"   Once this is done, you'll be able to see a WS-AT tab added to the DTC properties dialog This is where you will enable WS-AT support on the machine. Configure the HTTPS port to be used. Select an endpoint certificate and be sure that this certificate matches the machine name.
  6. A service-oriented enterprise system typically includes many tiers, including clients, services, business components, data access tiers, and of course the actual data store that usually includes stored procedures invoked by the data access tier. Transactions can be initiated at any of these tiers, depending on the application scenario. Figure 6-13. Transactions initiated at the (A) stored procedure; (B) data access tier; (C) business tier; (D) client (crossing service boundaries)