Skip to Main Content
Programming ASP.NET 3.5, 4th Edition
book

Programming ASP.NET 3.5, 4th Edition

by Dan Maharry, Dan Hurwitz, Jesse Liberty
October 2008
Intermediate to advanced content levelIntermediate to advanced
1166 pages
28h 31m
English
O'Reilly Media, Inc.
Content preview from Programming ASP.NET 3.5, 4th Edition

Binding to Business Objects

Most of the applications we’ve looked at in this book have been two-tier, separating the user interface from the backend data. Many larger commercial applications, however, are n-tier, with at least a middle business-logic layer to separate retrieval of data from the database from manipulation (and validation) of that data before presentation.

In Chapter 7, you saw how you can use the ObjectDataSource to reference a class that provides the data to be presented on the page. Taking this example one step further, you can create a simple Model-View-Controller (MVC) style designed site which uses a stateless class to encapsulate business logic, and a “model” class that knows how to load and store data from the database.

To illustrate implementing the n-tier MVC pattern, you’ll create a stateless business class, CustomerBusinessLogic, and a “model” of the Customer table in the AdventureWorksLT database, named AWCustomer. You’ll bind an ObjectDataSource to the stateless business-logic class, which will use the Model class to get and retrieve data about customers in the database.

Tip

This is a much simplified example of the MVC model made to fit within a few pages of a book. Fully fledged MVC site templates are available to download for almost all languages. Ruby on Rails is the most well-known example, but Microsoft is also working on its own MVC site templates for Visual Studio development. See Chapter 21 for more information on that.

To begin, add a new class called ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Microsoft® ASP.NET 3.5

Programming Microsoft® ASP.NET 3.5

Dino Esposito
Learning ASP.NET 3.5, 2nd Edition

Learning ASP.NET 3.5, 2nd Edition

Brian MacDonald, Dan Hurwitz, Jesse Liberty
Pro ASP.Net 4 in C# 2010

Pro ASP.Net 4 in C# 2010

Matthew MacDonald, Adam Freeman, Mario Szpuszta
Programming .NET 3.5

Programming .NET 3.5

Jesse Liberty, Alex Horovitz

Publisher Resources

ISBN: 9780596156657Supplemental ContentErrata Page