Conclusion

The COM Interop Services

In .NET, the COM Interop Services (CIS) layer provides access to existing COM components in a codeless and seamless way without requiring modification of the original component. COM components and .NET classes are conceptually similar although they are based on different models. They don t know how to interact with each other, but their inherent similarity makes it easy for you to build a wrapper that exposes COM components as .NET classes and vice versa. The system module that provides this kind of service is the CIS, which is made of two distinct parts: one part makes COM components usable from within .NET applications; and one part does the opposite, namely making .NET classes callable from within a COM component.

When you want to incorporate COM code into a managed .NET application, you import the relevant information found in the type library by using a utility named tlbimp.exe. The imported information is summarized in a new .NET class that retains the same name found in the type library and also mirrors its methods and properties. The involved types are adapted to the .NET type system. After the importation is complete, the original COM object is ready for use the .NET way.

To call .NET managed code from within a COM application, you need to map the .NET assembly metadata to COM type library information and registry entries. After the .NET class is made up to look like a COM object, any COM client can use it as though the class were a true COM class. In order to retrieve this .NET class, you need to mark it with some special attributes and use another utility (tlbexp.exe) to generate and register type library information. The MSDN documentation contains detailed tutorials that cover both aspects of COM Interop Services.



Building Web Solutions with ASP. NET and ADO. NET
Building Web Solutions with ASP.Net and ADO.NET
ISBN: 0735615780
EAN: 2147483647
Year: 2002
Pages: 75
Authors: Dino Esposito

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net