Performance Consulting: A Practical Guide for HR and Learning Professionals

 
Chapter 17 - COM Interoperability
bySimon Robinsonet al.
Wrox Press 2002

  

Overview

In this chapter we will look at COM interoperability with .NET. COM components and .NET components are not innately compatible because they rely on different internal architectures. Since many organizations rely extensively on COM components for their middle- tier services, it will be important for many .NET solutions to exploit these legacy components. The .NET Framework does indeed provide facilities for manipulating COM components from managed, .NET code, and also consuming .NET components from unmanaged code: code that is not managed by the .NET runtime.

At the heart of COM interoperability is the idea of wrapper classes that translate specific calls from a managed client into COM-specific invocation requests on the unmanaged COM component. Thus a .NET application can be fooled into thinking it is dealing with another .NET component, and a COM component can believe it is dealing with a standard COM-aware client. Conversely, another type of wrapper allows .NET components to be consumed from unmanaged code.

In this chapter, well show you how to achieve interoperability between COM and .NET.

Well start with a brief review of COM, followed by a look at using COM components from .NET, in which we will cover:

Then, well look at using .NET components from COM clients , and cover:

Finally, well take a look at platform invocation services, and how .NET can interoperate with unmanaged code in any DLL, such as the Win32 API.

  

Категории