Geeks With Blogs

Scott Kuhl Warning: I may have no idea what I am talking about!

Auto generated classes may expose a simple object based interface, but below the surface the data is being held in ADO.NET DataTables.  SubSonic exposes a few methods that allow you to get at the underlying structure.

The TableName property returns the name of the actual table associated with the object.

product.TableName;

The static class method GetTableSchema returns the underlying table.

SubSonic.TableSchema.Table tableSchema = Product.GetTableSchema();

Note: There is also a static property Schema that returns the same information.  For the property to work, the class must be instantiated at least once.  The GetTableSchema takes care of this for you.  Both of these methods will be used later when examining SubSonic's query functionality.

The Inspect method returns an HTML representation of the object using <table> markup tags.  There is an overloaded version of the method that takes a single boolean parameter, useHtml, that can be set to false to return plain text.

string html = product.Inspect();

Find the entire series of posts here.

Posted on Wednesday, December 6, 2006 10:36 PM SubSonic | Back to top


Comments on this post: Getting Started with SubSonic - Part 12, Classes - Underlying Data

# re: Getting Started with SubSonic - Part 12, Classes - Underlying Data
Requesting Gravatar...
SubSonic 2.1 private static void GetTableSchema(){} this is a static method
Left by jackyxm on Jul 02, 2009 9:44 PM

# re: Getting Started with SubSonic - Part 12, Classes - Underlying Data
Requesting Gravatar...
at the sametime it is a private method , Product can't call
Left by jackyxm on Jul 02, 2009 9:46 PM

Your comment:
 (will show your gravatar)


Copyright © Scott Kuhl | Powered by: GeeksWithBlogs.net