Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 15.  Using Business Objects

Today you learned a lot about advanced Web development. Using and creating business objects is a big step toward becoming an expert ASP.NET developer. And as you learned today, using them with ASP.NET is simple!

Components are reusable programming elements that can provide additional functionality to your ASP.NET pages. They usually represent some form of real-world object, although they're not required to. Business objects are components that implement code that's applicable to your application in the middle layer of a three-tier application.

Building business objects is similar to building code-behind forms. You start with a class in VB.NET or C# and add the necessary functionality to describe your objects. You can compile them from the command line with the VB.NET or C# compiler. You then use them from your ASP.NET pages just as you would use any other object declare a variable with the type of your new object, instantiate it with the new keyword, and use its properties and methods.

COM objects are older components developed in a non-.NET environment. These objects don't support the CLR and don't contain metadata. You can use them from your ASP.NET pages with the Server.CreateObject method by supplying a valid progId.

You can bring these COM objects into compliance with the CLR by using the Type Library Importer (tlbimp.exe) to produce the appropriate metadata. The Type Library Importer doesn't actually change the existing COM object, but rather creates an interpretation layer between the COM object and the CLR. This avoids the costs of marshalling the objects and lets you use them in your ASP.NET just as you use .NET objects.

Tomorrow you'll start looking at Web services, a new way to deliver applications over the Internet through ASP.NET.


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne © 2008-2017.
    If you may any questions please contact us: