SlideShare une entreprise Scribd logo
1  sur  17
.NET Enterprise Services
and their Implementation


                  Presented By:

              KASHIF ALEEM
               SP10-MS-0016
Enterprise Services
 Provides support for
    Distributed Transactions
    Security
    Object Pooling
    Just in time activation
    Queued Components
    Loosely Coupled Events
    Server Application Process Model
Enterprise Services
 The .NET Enterprise Services are today a
 wrapper around the COM+ Service
    Are a strategic part of .NET
 In .NET, those types are know under the
 name
    .NET Enterprise Services
Transaction Service


  Transaction is a unit of work in which a series of
  operations occur.

  COM+ uses programmatic transactions to ensure
  that resources are not permanently updated unless
  all operations within the transaction complete
  successfully.
Transaction Service (Example)
Transaction Service (Example)
<TransactionAttribute(TransactionOption.Required)> _
Public Class TransferService
    Inherits ServicedComponent

    Public Function transfer(ByVal ConnString1 As String, _
                        ByVal ConnString2 As String, _
                        ByVal Account1 As String, ByVal Account2 As String, _
                        ByVal AmountToTransfer As Integer) As Boolean

        Dim RetValue As Boolean
        Dim objCredit As New BankOne
        Dim objCharge As New BankTwo

        Try
          objCredit.credit(ConnString2, Account2, AmountToTransfer)
          objCharge.charge(ConnString1, Account1, AmountToTransfer)
          RetValue = True
          ContextUtil.SetComplete()

         Catch exc As Exception
           ContextUtil.SetAbort()
           . . .
         End Try
     End Function
End Class
Transaction Service (Example)
  <TransactionAttribute(TransactionOption.Required)> _
  Public Class BankOne
    Inherits ServicedComponent

  Public Sub charge(ByVal ConnString As String, _
      ByVal Account As String, ByVal AmountToCharge As Integer)

      Dim strSQL As String
      strSQL = "UPDATE Accounts SET   … WHERE Description = '" & Account & "'“

      Dim RowsUpdated As Integer
      Dim cnn As New SqlConnection(ConnString)
      Dim cmd As New SqlCommand(strSQL, cnn)

      Try
        cnn.Open()
        RowsUpdated = cmd.ExecuteNonQuery()

        If RowsUpdated = 1 Then
          ContextUtil.SetComplete()
          Exit Sub
        Else ' UPDATE failed
          ContextUtil.SetAbort()
          Throw New Exception("Invalid account or insufficient money.")
        End If

      Catch exc As Exception
        ContextUtil.SetAbort()
        . . .
      End Try
    End Sub
  End Class
Transaction Service (Example)
 <TransactionAttribute(TransactionOption.Required)> _
 Public Class BankTwo
   Inherits ServicedComponent

   Public Sub credit(ByVal ConnString As String, _
     ByVal Account As String, ByVal AmountToCredit As Integer)
     Dim strSQL As String
     strSQL = "UPDATE Accounts SET … WHERE Description = '" & Account & "'"


     Dim RowsUpdated As Integer      ' Number of modified rows
     Dim cnn As New SqlConnection(ConnString)
     Dim cmd As New SqlCommand(strSQL, cnn)
     Try
       cnn.Open()
       RowsUpdated = cmd.ExecuteNonQuery()
       If RowsUpdated = 1 Then
         ContextUtil.SetComplete()
         Exit Sub
       Else
         ' UPDATE failed
         ContextUtil.SetAbort()
         Throw New Exception("Invalid account.")
       End If
     Catch exc As Exception
       ContextUtil.SetAbort()
       . . .
     End Try
   End Sub
 End Class
Transaction Service (Example)
Queued Components

 Queued components provide for an easy
 implementation of asynchronous (as well as
 disconnected) method calls, where the client
 does not have to wait until the method call
 finishes.
 The Queued component architecture in
 COM+ internally uses the MSMQ queues to
 deliver the messages (method calls) to a
 COM+ component.
 The transmitted message is stored in the
 queue and attempted for delivery when the
 receiving component’s machine becomes
 available.
Queued Components (Cont’d.)


                                         Server
       Client        MSMQ Queue


  QC Recorder (COM                Queued Component
     component)      MSMQ Queue        Listener


                     MSMQ Queue   Queued Component
                                  Player (COM comp.)


                                     COM Object
MSMQ Configuration

 Installation through Add/Remove
 Windows Components
MSMQ Configuration (Cont’d)

 Configuring Queues
Queued Components (Implementation)


Imports System.Messaging

. . .
Private Sub Send()
        Dim myQueue As MessageQueue

        Try

              ' connect to the queue and send the message
              myQueue = New MessageQueue(".private$DevXTestQueue”)
              myQueue.Send("Test Message”)

        Catch ex As Exception
            MessageBox.Show("Exception was thrown: " & ex.Source & ": " &
                 ex.Message)
        End Try
    End Sub
Queued Components (Implementation)
Queued Components (Implementation)
.Net Enterprise Services and their Implementations

Contenu connexe

Tendances

オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)
Takayuki Goto
 

Tendances (20)

(18.03.2009) Cumuy Invita - Iniciando el año conociendo nuevas tecnologías - ...
(18.03.2009) Cumuy Invita - Iniciando el año conociendo nuevas tecnologías - ...(18.03.2009) Cumuy Invita - Iniciando el año conociendo nuevas tecnologías - ...
(18.03.2009) Cumuy Invita - Iniciando el año conociendo nuevas tecnologías - ...
 
Async History - javascript
Async History - javascriptAsync History - javascript
Async History - javascript
 
Process control nodejs
Process control nodejsProcess control nodejs
Process control nodejs
 
Rxjs vienna
Rxjs viennaRxjs vienna
Rxjs vienna
 
The Ring programming language version 1.6 book - Part 23 of 189
The Ring programming language version 1.6 book - Part 23 of 189The Ring programming language version 1.6 book - Part 23 of 189
The Ring programming language version 1.6 book - Part 23 of 189
 
Json.parse() in JavaScript
Json.parse() in JavaScriptJson.parse() in JavaScript
Json.parse() in JavaScript
 
The Ring programming language version 1.8 book - Part 26 of 202
The Ring programming language version 1.8 book - Part 26 of 202The Ring programming language version 1.8 book - Part 26 of 202
The Ring programming language version 1.8 book - Part 26 of 202
 
The Ring programming language version 1.9 book - Part 28 of 210
The Ring programming language version 1.9 book - Part 28 of 210The Ring programming language version 1.9 book - Part 28 of 210
The Ring programming language version 1.9 book - Part 28 of 210
 
ReactiveCocoa in Practice
ReactiveCocoa in PracticeReactiveCocoa in Practice
ReactiveCocoa in Practice
 
Asynchronous programming
Asynchronous programmingAsynchronous programming
Asynchronous programming
 
Mule esb object_to_jackson_json
Mule esb object_to_jackson_jsonMule esb object_to_jackson_json
Mule esb object_to_jackson_json
 
No More Deadlocks; Asynchronous Programming in .NET
No More Deadlocks; Asynchronous Programming in .NETNo More Deadlocks; Asynchronous Programming in .NET
No More Deadlocks; Asynchronous Programming in .NET
 
Road to react hooks
Road to react hooksRoad to react hooks
Road to react hooks
 
オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)
 
Angular2 rxjs
Angular2 rxjsAngular2 rxjs
Angular2 rxjs
 
ESNext - Javascript future
ESNext - Javascript futureESNext - Javascript future
ESNext - Javascript future
 
The Ring programming language version 1.5.4 book - Part 21 of 185
The Ring programming language version 1.5.4 book - Part 21 of 185The Ring programming language version 1.5.4 book - Part 21 of 185
The Ring programming language version 1.5.4 book - Part 21 of 185
 
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyC++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
 
Learn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great GoodLearn You a ReactiveCocoa for Great Good
Learn You a ReactiveCocoa for Great Good
 
Asynchronous programming from Xamarin Hakcday in Melbourne
Asynchronous programming from Xamarin Hakcday in MelbourneAsynchronous programming from Xamarin Hakcday in Melbourne
Asynchronous programming from Xamarin Hakcday in Melbourne
 

Similaire à .Net Enterprise Services and their Implementations

Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Mario Fusco
 
Client-server architecture (clientserver) is a network architecture .pdf
Client-server architecture (clientserver) is a network architecture .pdfClient-server architecture (clientserver) is a network architecture .pdf
Client-server architecture (clientserver) is a network architecture .pdf
fabmallkochi
 

Similaire à .Net Enterprise Services and their Implementations (20)

DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
 
C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴
 
Maintaining Your Code Clint Eastwood Style
Maintaining Your Code Clint Eastwood StyleMaintaining Your Code Clint Eastwood Style
Maintaining Your Code Clint Eastwood Style
 
WCF and WF in Framework 3.5
WCF and WF in Framework 3.5WCF and WF in Framework 3.5
WCF and WF in Framework 3.5
 
VB net lab.pdf
VB net lab.pdfVB net lab.pdf
VB net lab.pdf
 
Akka: Actor Design & Communication Technics
Akka: Actor Design & Communication TechnicsAkka: Actor Design & Communication Technics
Akka: Actor Design & Communication Technics
 
Better Open Source Enterprise C++ Web Services
Better Open Source Enterprise C++ Web ServicesBetter Open Source Enterprise C++ Web Services
Better Open Source Enterprise C++ Web Services
 
Taming event-driven software via formal verification
Taming event-driven software via formal verificationTaming event-driven software via formal verification
Taming event-driven software via formal verification
 
Flying Futures at the same sky can make the sun rise at midnight
Flying Futures at the same sky can make the sun rise at midnightFlying Futures at the same sky can make the sun rise at midnight
Flying Futures at the same sky can make the sun rise at midnight
 
Kamaelia Protocol Walkthrough
Kamaelia Protocol WalkthroughKamaelia Protocol Walkthrough
Kamaelia Protocol Walkthrough
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
 
Vb Project ขั้นเทพ
Vb Project ขั้นเทพVb Project ขั้นเทพ
Vb Project ขั้นเทพ
 
Client-server architecture (clientserver) is a network architecture .pdf
Client-server architecture (clientserver) is a network architecture .pdfClient-server architecture (clientserver) is a network architecture .pdf
Client-server architecture (clientserver) is a network architecture .pdf
 
Codes
CodesCodes
Codes
 
Introduction to embedded computing and arm processors
Introduction to embedded computing and arm processorsIntroduction to embedded computing and arm processors
Introduction to embedded computing and arm processors
 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonf
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)
 
Sqlapi0.1
Sqlapi0.1Sqlapi0.1
Sqlapi0.1
 
Apache kafka part 2
Apache kafka part  2Apache kafka part  2
Apache kafka part 2
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

.Net Enterprise Services and their Implementations

  • 1. .NET Enterprise Services and their Implementation Presented By: KASHIF ALEEM SP10-MS-0016
  • 2. Enterprise Services Provides support for  Distributed Transactions  Security  Object Pooling  Just in time activation  Queued Components  Loosely Coupled Events  Server Application Process Model
  • 3. Enterprise Services The .NET Enterprise Services are today a wrapper around the COM+ Service  Are a strategic part of .NET In .NET, those types are know under the name  .NET Enterprise Services
  • 4. Transaction Service Transaction is a unit of work in which a series of operations occur. COM+ uses programmatic transactions to ensure that resources are not permanently updated unless all operations within the transaction complete successfully.
  • 6. Transaction Service (Example) <TransactionAttribute(TransactionOption.Required)> _ Public Class TransferService Inherits ServicedComponent Public Function transfer(ByVal ConnString1 As String, _ ByVal ConnString2 As String, _ ByVal Account1 As String, ByVal Account2 As String, _ ByVal AmountToTransfer As Integer) As Boolean Dim RetValue As Boolean Dim objCredit As New BankOne Dim objCharge As New BankTwo Try objCredit.credit(ConnString2, Account2, AmountToTransfer) objCharge.charge(ConnString1, Account1, AmountToTransfer) RetValue = True ContextUtil.SetComplete() Catch exc As Exception ContextUtil.SetAbort() . . . End Try End Function End Class
  • 7. Transaction Service (Example) <TransactionAttribute(TransactionOption.Required)> _ Public Class BankOne Inherits ServicedComponent Public Sub charge(ByVal ConnString As String, _ ByVal Account As String, ByVal AmountToCharge As Integer) Dim strSQL As String strSQL = "UPDATE Accounts SET … WHERE Description = '" & Account & "'“ Dim RowsUpdated As Integer Dim cnn As New SqlConnection(ConnString) Dim cmd As New SqlCommand(strSQL, cnn) Try cnn.Open() RowsUpdated = cmd.ExecuteNonQuery() If RowsUpdated = 1 Then ContextUtil.SetComplete() Exit Sub Else ' UPDATE failed ContextUtil.SetAbort() Throw New Exception("Invalid account or insufficient money.") End If Catch exc As Exception ContextUtil.SetAbort() . . . End Try End Sub End Class
  • 8. Transaction Service (Example) <TransactionAttribute(TransactionOption.Required)> _ Public Class BankTwo Inherits ServicedComponent Public Sub credit(ByVal ConnString As String, _ ByVal Account As String, ByVal AmountToCredit As Integer) Dim strSQL As String strSQL = "UPDATE Accounts SET … WHERE Description = '" & Account & "'" Dim RowsUpdated As Integer ' Number of modified rows Dim cnn As New SqlConnection(ConnString) Dim cmd As New SqlCommand(strSQL, cnn) Try cnn.Open() RowsUpdated = cmd.ExecuteNonQuery() If RowsUpdated = 1 Then ContextUtil.SetComplete() Exit Sub Else ' UPDATE failed ContextUtil.SetAbort() Throw New Exception("Invalid account.") End If Catch exc As Exception ContextUtil.SetAbort() . . . End Try End Sub End Class
  • 10. Queued Components Queued components provide for an easy implementation of asynchronous (as well as disconnected) method calls, where the client does not have to wait until the method call finishes. The Queued component architecture in COM+ internally uses the MSMQ queues to deliver the messages (method calls) to a COM+ component. The transmitted message is stored in the queue and attempted for delivery when the receiving component’s machine becomes available.
  • 11. Queued Components (Cont’d.) Server Client MSMQ Queue QC Recorder (COM Queued Component component) MSMQ Queue Listener MSMQ Queue Queued Component Player (COM comp.) COM Object
  • 12. MSMQ Configuration Installation through Add/Remove Windows Components
  • 13. MSMQ Configuration (Cont’d) Configuring Queues
  • 14. Queued Components (Implementation) Imports System.Messaging . . . Private Sub Send() Dim myQueue As MessageQueue Try ' connect to the queue and send the message myQueue = New MessageQueue(".private$DevXTestQueue”) myQueue.Send("Test Message”) Catch ex As Exception MessageBox.Show("Exception was thrown: " & ex.Source & ": " & ex.Message) End Try End Sub