Managed Component Overview


If you have developed COM or ActiveX components, you will find managed components significantly easier to develop. Managed components execute on top of the common language runtime (CLR) and automatically benefit from CLR features such as language interoperability, automatic memory management, and code access security. In addition, managed components have a simpler deployment model and are easier to version. Because the CLR provides low-level plumbing for managed components, you can focus on designing and implementing the real functionality of your components .

Authoring a managed component is no different from writing a class in a programming language that targets the CLR. Unlike COM components written in C++, you do not have to do any additional work to convert a class into a component.

When developing managed components, you need to be aware of a few basic programming constructs and follow a few simple guidelines. The following list contains a high-level summary of the guidelines that you should follow when designing and implementing a component.

  • Author your component in a programming language that targets the CLR, such as C# or Microsoft Visual Basic .NET.

  • Expose an object model that consists of properties, methods , and events. You do not have to expose all these constructs, but the public and protected members of a component should correspond to these constructs. In addition, you can describe your component's members through metadata attributes. We'll describe these programming constructs in more detail later in this chapter.

  • Expose members that are compliant with the common language specification (CLS) to ensure that your component is usable from other programming languages that target the CLR. The CLS is a subset of programming features that are common to all languages targeting the CLR.

  • Make sure that your component conforms to .NET Framework design guidelines. These guidelines include naming conventions and implementation patterns. By conforming to the design guidelines, you will ensure that your component interoperates seamlessly with classes in the .NET Framework and provides a similar developer experience.

  • To get the full benefit of the designer architecture in the .NET Framework, implement the IComponent interface or derive from a class such as System . ComponentModel.Component that implements this interface. We'll discuss design-time functionality in detail in Chapter 15, "Design-Time Functionality."

  • Deploy your managed component as part of a class library in an assembly (managed library). We'll discuss deployment in Chapter 17, "Localization, Licensing, and Other Miscellany."

Next we'll look at the main constructs in component programming ” ­properties, methods, events, and metadata attributes.



Developing Microsoft ASP. NET Server Controls and Components
Developing Microsoft ASP.NET Server Controls and Components (Pro-Developer)
ISBN: 0735615829
EAN: 2147483647
Year: 2005
Pages: 183

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