I am not sure how long the ScaffoldTable and ScaffoldColumn Attributes have been a part of ASP.NET Dynamic Data, but I love the fact that they exist. The idea is this. You want to take advantage of the automatic scaffolding of ASP.NET Dynamic Data to its fullest extent, but there are times you may have a few tables or columns that you don't want to display. The easiest way to control this is via metadata, and ASP.NET Dynamic Data provides two attributes that allow you to turn on and off the scaffolding of tables and columns - ScaffoldTable and ScaffoldColumn.
Note this tutorial assumes you have created a LINQ To SQL or ADO.NET Entity Data Model as I have shown previously in several ASP.NET Dynamic Data Tutorials. We will be creating partial classes based on classes in your object model created from the Northwind Database.
ScaffoldTable
Simply enough, the constructor of ScaffoldTable takes a boolean value ( true / false ) as to whether you want the table to be displayed by Dynamic Data. One can tell ASP.NET Dynamic Data not to display the Products Table in the Northwind Database by creating a partial class of Product and decorating it with the ScaffoldTable Attribute as such:
[ScaffoldTable(false)]
public partial class Product
{
}
You also have the option of putting the ScaffoldTable Attribute on a Buddy Metadata Class for Product, ProductMetadata, who carries the burden of holding the metadata for Product.
[MetadataType(typeof(ProductMetadata))]
public partial class Product
{
}
[ScaffoldTable(false)]
public partial class ProductMetadata
{
}
Note you can get your metadata from anywhere, but out of the box ASP.NET Dynamic Data has a BuddyMetadataProvider:
The end result of saying that the Products Table is no longer scaffolded is that it does not get added to the MetaModel.VisibleTables Property. When you loop through VisibleTables, Products will not be included. Hence, the out-of-the-box Default.aspx page looks like:

And you thought it would be more exciting that that :) Not real exciting, but still very valuable. Open up the Default.aspx.cs for your default ASP.NET Dynamic Data Website and you will see why Products is missing:
protected void Page_Load(object sender, EventArgs e)
{
System.Collections.IList visibleTables =
MetaModel.Default.VisibleTables;
if (visibleTables.Count == 0)
{
throw new InvalidOperationException("...");
}
Menu1.DataSource = visibleTables;
Menu1.DataBind();
}
Yep, the main menu is binding to the VisibleTables Property ( not the Tables Property ) and so Products will not be shown. Surprisingly, you will still find that other tables with associations to the Products Table still have references to Products even though there is no link:

Doesn't seem intuitive to me that it still exists, but the ScaffoldColumn Attribute will allow you to turn off the display of a column.
ScaffoldColumn
Given all the information above, I think we can pretty much understand the ScaffoldColumn Attribute. Let's go ahead and remove the displaying of that pesky Products Column from the Categories Table so we don't have to look at a dead reference to a table we didn't want scaffolded. Let's create a partial Category Class, associate it with a BuddyMetadata Class ( CategoryMetadata ), and add the ScaffoldColumn Attribute to the Products Property:
[MetadataType(typeof(CategoryMetadata))]
public partial class Category
{
}
public partial class CategoryMetadata
{
[ScaffoldColumn(false)]
public EntitySet<Product> Products { get; set; }
}
Now that we have turned off the display of the Products Property, the Categories List Page in our ASP.NET Dynamic Data Website looks as follows:

Better. Much better. We can add the ScaffoldColumn Attribute to any Property on our BuddyMetadata Classes.
Conclusion
A lot of information on the very basic concepts of ScaffoldTable and ScaffoldColumn Attributes in ASP.NET Dynamic Data, but hopefully you found it a little bit interesting :) Next time we will get into the art of validation and creating your own ValidationAttributes.
Note that above I am using the words Tables, Classes, and Entities interchangeably and one could correctly argue that since ASP.NET Dynamic Data is probably using LINQ To SQL or the ADO.NET Entity Framework that I should be focusing on classes and entities, because the O/R Mappers are abstracting away the Database Model for an object model. Given that a lot of the classes and properties of ASP.NET Dynamic Data are still using database related nomenclature ( e.g. ScaffoldTable, ScaffoldColumn, VisibleTables ), my terminology is a little loosey-goosey. However, I think you get the idea :)
Hope this helps.
David Hayden
ASP.NET Dynamic Data Tutorials