Maximizing ASP.NET Real World, Object-Oriented Development [Electronic resources]

Jeffrey Putz

نسخه متنی -صفحه : 171/ 40
نمايش فراداده

Using Classes for Simple Data Structures

To this point, we''ve focused on making a class perform some kind of work. We can also use a class to represent some kind of data structure or to act as a bucket for pieces of data that should be grouped together.

Object/relational mapping is a technique where a programmer can manipulate a class instance''s properties and persist the changes in data to a data store. This hides the database plumbing and implementation and enables the developer to concentrate on manipulating the data. A framework generally maps database fields to properties of a class. The forthcoming ObjectSpaces (originally intended to ship with .NET v2.0) is an example of this technology in action.

The part that you "develop" is just a shell of properties. Populated with data, instances of these objects can be grouped together in an ArrayList or other collection and can be bound to controls.

We''ll actually build a class like this in Chapter 5, "Object-Oriented Programming Applied: A Custom Data Class," except we''ll add a number of methods to handle creation, retrieval, updating, and deletion of the data.