8.11. Create a Database Object Model

Problem

You need to create objects that map directly to tables in a relational database.

Solution

Use the Object Relational Designer (O/R Designer) to automatically generate .NET classes that map directly to tables within the target database.

How It Works

LINQ to SQL, the Language Integrated Query (see Chapter 6) API, provides integrated query support for databases. It accomplishes this by using object classes, created in any .NET language, that tightly map to tables in a database. Instead of creating string-based commands to collect or change data in a database, as shown in the earlier recipes in this chapter, you simply change property values or create new instances of the mapped object classes.

Although ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.