Closed Thread
Results 1 to 3 of 3

Thread: .NET and serviced components

  1. #1
    Join Date
    Aug 2008
    Posts
    5
    Rep Power
    0

    .NET and serviced components

    The .NET Framework provides enterprise services for building highly scalable solutions, but the implementation can be tricky. Learn when and where these services should be used.

    One of the biggest mistakes architects can make when designing Enterprise Services is to assume that its sole purpose is to provide wrappers for existing unmanaged COM+ and MTS functionality. It’s a common assumption, given that the current Enterprise Services implementation provides little more than a managed interface to unmanaged COM+.

    However, Microsoft views Enterprise Services quite differently. In its eyes, Enterprise Services is the replacement for COM+ and MTS. Going forward, Microsoft has two primary goals for new versions of the .NET Framework, starting with release 1.1 that’s due with Windows .NET Server 2003. First, all existing COM+ functionality will move to managed code. Second, all new distributed systems management functionality will be implemented in Enterprise Services in .NET. In fact, COM+ version 1.5 (released with Windows XP) will likely be the last version of COM+ available as an unmanaged release.

    What is Enterprise Services?
    Given Microsoft’s emphasis on Enterprise Services as its distributed systems development platform, you need to understand exactly what services Microsoft is talking about. Enterprise Services supports resource management in a distributed environment. This functionality includes support for distributed transactions, role-based security and packaging of objects, object pooling, just-in-time-activation (JITA), queued components, and loosely coupled events. When used together, these functions give architects the tools to implement a complete server application process model.

    One of the most confusing aspects of Enterprise Services is when to use them. If your existing systems use COM+ extensively, you’ll naturally want to use Enterprise Services when porting your applications to .NET. But if you don’t use COM+ today, how do you get started and what’s the benefit?

    Implementing transaction support
    To understand how you can get started with Enterprise Services, let’s look at how you implement transaction support in three different scenarios: traditional distributed applications, Web services, and ASP.NET applications. It’s important to differentiate between how developers handle transactions in the COM+ world vs. .NET. In COM+, developers manually start a transaction and then check conditions to determine whether the transaction should be committed or aborted. But .NET lets you handle transaction commits and aborts automatically by using declarations exposed through attributes. In other words, you can think of distributed transactions as automatic or declarative transactions in .NET. (Developers still have the option of coding commits and aborts manually if they need that granular level of control.)

    Traditional distributed applications
    For a traditional distributed application, the developer needs to create a server object and then code the client to call the server object. Here’s a simple implementation of a server object implemented in C#:

    using System;
    using System.EnterpriseServices;
    [assembly : ApplicationName("TxDemo")]

    [Transaction]
    public class Account : ServicedComponent {
    [AutoComplete]
    public void Credit() {
    // do some work
    } }

    We should note three important items from this sample. First, the statement, using System.EnterpriseServices; gives you access to attributes in the Enterprise Services namespace. Second, the Account class inherits from the existing ServicedComponent class, where it gets its ability to be managed by EnterpriseServices. Finally, the Transaction and AutoComplete attributes make objects instantiated from this class transactional. The AutoComplete attribute tells EnterpriseServices to commit the work done in the Credit function unless an error occurs, in which case it should abort. You still can catch exceptions and swallow them (i.e., not Throw them up the call stack) with AutoComplete committing the transaction.

    Here’s the code required to use the Credit object from a client application:

    public Class AccountClient {
    private void Transactions_Click() {
    Account account = New Account();
    order.Credit()
    } }

    Notice that the client has no idea that the server object uses transaction management.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Oct 2008
    Posts
    1
    Rep Power
    0

    Re: .NET and serviced components

    Awesome post..
    IT has been very useful and helpful for me.
    Thanks for sharing...

  4. #3
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    Re: .NET and serviced components

    And I can't seem to find it anywhere else on the net, so well done.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Damaged components
    By Jrb in forum Computer Hardware
    Replies: 4
    Last Post: 10-18-2011, 09:21 PM
  2. Anyone see any issues with these components?
    By bbqroast in forum Computer Hardware
    Replies: 0
    Last Post: 10-08-2011, 01:23 AM
  3. GUI problem, components not displaying?
    By ZipOnTrousers in forum Java Help
    Replies: 7
    Last Post: 01-09-2010, 04:23 AM
  4. WinFX Components
    By brackett in forum C# Programming
    Replies: 2
    Last Post: 06-01-2006, 06:24 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts