8.12. Generate Data Object Classes from the Command Line

Problem

You need to create objects that map directly to tables in a relational database, but you do not have access to Visual Studio 2008 or can't use the O/R Designer for some reason.

Solution

Use SqlMetal.exe to automatically generate .NET classes that map directly to tables within the target database.

How It Works

Recipe 8-11 covers the basics on using the new Object Relational Designer (O/R Designer) to create a set of object classes that model a relational database. Since a situation may arise where you need to perform this same functionality from the command line, Visual Studio 2008 also includes the SqlMetal.exe utility.

SqlMetal.exe is distributed with Visual Studio 2008 and is ...

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.