.NET Enterprise Servicesand their Implementation                  Presented By:              KASHIF ALEEM               SP...
Enterprise Services Provides support for    Distributed Transactions    Security    Object Pooling    Just in time act...
Enterprise Services The .NET Enterprise Services are today a wrapper around the COM+ Service    Are a strategic part of ....
Transaction Service  Transaction is a unit of work in which a series of  operations occur.  COM+ uses programmatic transac...
Transaction Service (Example)
Transaction Service (Example)<TransactionAttribute(TransactionOption.Required)> _Public Class TransferService    Inherits ...
Transaction Service (Example)  <TransactionAttribute(TransactionOption.Required)> _  Public Class BankOne    Inherits Serv...
Transaction Service (Example) <TransactionAttribute(TransactionOption.Required)> _ Public Class BankTwo   Inherits Service...
Transaction Service (Example)
Queued Components Queued components provide for an easy implementation of asynchronous (as well as disconnected) method ca...
Queued Components (Cont’d.)                                         Server       Client        MSMQ Queue  QC Recorder (CO...
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      ...
Queued Components (Implementation)
Queued Components (Implementation)
.Net Enterprise Services and their Implementations
Upcoming SlideShare
Loading in …5
×

.Net Enterprise Services and their Implementations

384 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
384
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

.Net Enterprise Services and their Implementations

  1. 1. .NET Enterprise Servicesand their Implementation Presented By: KASHIF ALEEM SP10-MS-0016
  2. 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. 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. 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.
  5. 5. Transaction Service (Example)
  6. 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 FunctionEnd Class
  7. 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. 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
  9. 9. Transaction Service (Example)
  10. 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. 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. 12. MSMQ Configuration Installation through Add/Remove Windows Components
  13. 13. MSMQ Configuration (Cont’d) Configuring Queues
  14. 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
  15. 15. Queued Components (Implementation)
  16. 16. Queued Components (Implementation)

×