Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

SchemaExplorer is CodeSmithCodeSmith Generator's built-in interface for working with metadata from databases. You can use the classes in SchemaExplorer either programmatically or interactively; often, you'll combine the two approaches. For example, you may want to allow the user to interactively select a database, and then programmatically build a list of all of the tables in the selected database. Here's a template that demonstrates using SchemaExplorer for this purpose:

...

Before you can execute this template, you must supply a value for the SourceDatabase property. When you place your cursor in the property sheet row for this property, CodeSmith will Generator will display a builder button, indicating that there is an external editor hooked up for this property. CodeSmith automatically Generator automatically uses editors built into SchemaExplorer:

...

If you choose to add a new data source, SchemaExplorer opens the Data Source dialog box. To add a new data source, you must provide a name for the new data source, then select a provider type and type in a connection string. CodeSmith ships Generator ships with providers for SQL Server and ADOX data sources.

...

After the user specifies the SourceDatabase, CodeSmith is Generator is able to use it as the root of an object model of the entire database.

...