Choosing Objects

SchemaExplorer implements designers for four other database object types. These are useful when you need to let users select a particular object or set of objects within a database as part of your template metadata.

TableSchema and TableSchemaCollection

The TableSchema editor allows selecting a single table:

<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Database" Description="Select a table." %>

The TableSchemaCollection editor allows selecting a group of tables:

<%@ Property Name="SourceTables" Type="SchemaExplorer.TableSchemaCollection" Category="Database" Description="Select a set of tables." %>

A property using either of these types will display the Table Picker when the user clicks the Build button in the Properties window. If the property uses the TableSchema class, the user can select a single object. If the property uses the TableSchemaCollection class, the user can use Ctrl+click and Shift+click to select multiple objects.

ViewSchema and ViewSchemaCollection

The ViewSchema editor allows selecting a single view:

<%@ Property Name="SourceView" Type="SchemaExplorer.ViewSchema" Category="Database" Description="Select a view." %>

The ViewSchemaCollection editor allows selecting a group of views:

<%@ Property Name="SourceViews" Type="SchemaExplorer.ViewSchemaCollection" Category="Database" Description="Select a set of views." %>

A property using either of these types will display the ViewPicker when the user clicks the Build button in the Properties window. If the property uses the ViewSchema class, the user can select a single object. If the property uses the ViewSchemaCollection class, the user can use Ctrl+click and Shift+click to select multiple objects.

CommandSchema and CommandSchemaCollection

The CommandSchema editor allows selecting a single command (stored procedure):

<%@ Property Name="SourceCommand" Type="SchemaExplorer.CommandSchema" Category="Database" Description="Select a command." %>

The CommandSchemaCollection editor allows selecting a group of commands (stored procedures):

<%@ Property Name="SourceCommands"  Type="SchemaExplorer.CommandSchemaCollection" Category="Database"  Description="Select a set of commands." %>

A property using either of these types will display the Command Picker when the user clicks the Build button in the Properties window. If the property uses the CommandSchema class, the user can select a single object. If the property uses the CommandSchemaCollection class, the user can use Ctrl+click and Shift+click to select multiple objects.

Using Functions

You can also use consume SQL Functions and SQL CLR Functions using the CommandSchema and CommandSchemaCollection pickers. You can enabling the detection of functions by specifying IncludeFunctions="True" on the Property Directive.

You can specify the IncludeFunctions attribute on any Property Directive whose property type derives from SchemaObjectBase (E.G., CommandSchema, CommandSchemaCollection, DatabaseSchema...)

<%@ Property Name="SourceCommand" Type="SchemaExplorer.CommandSchema" IncludeFunctions="True" Category="Database" Description="Select a command." %>
A normal stored procedure will always return an int value as the return value. However, a scalar function can return any data type.

A CommandSchema instance may also contain the following extended properties. These properties will help you determine what kind of function you are consuming.

Extended Property KeySchemaExplorer.ExtendedPropertyName Property NameDescription
CS_IsCLRIsCLRAssembly (CLR) stored-procedure
CS_IsAggregateFunctionIsAggregateFunctionSQL aggregate function
CS_IsScalarFunctionIsScalarFunctionSQL scalar function
CS_IsTableValuedFunctionIsTableValuedFunctionSQL table-valued-function
CS_IsInlineTableValuedFunctionIsInlineTableValuedFunctionSQL inline table-valued function
CS_IsMultiStatementTableValuedFunctionIsMultiStatementTableValuedFunctionSQL multi statement table-valued function
You can download a sample template here that shows off how to detect and consume functions.

ColumnSchema and ColumnSchemaCollection

The ColumnSchema editor allows selecting a single command:

<%@ Property Name="SourceColumn" Type="SchemaExplorer.ColumnSchema" Category="Database" Description="Select a column." %>

The ColumnSchemaCollection editor allows selecting a group of tables:

<%@ Property Name="SourceColumns"  Type="SchemaExplorer.ColumnSchemaCollection" Category="Database"  Description="Select a set of columns." %>

A property using either of these types will display the Column Picker when the user clicks the Build button in the Properties window. If the property uses the ColumnSchema class, the user can select a single object. If the property uses the ColumnSchemaCollection class, the user can check the columns to select multiple objects.