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 CommandSchema instance may also contain the following extended properties. These properties will help you determine what kind of function you are consuming.
Extended Property Key | SchemaExplorer.ExtendedPropertyName Property Name | Description |
---|---|---|
CS_IsCLR | IsCLR | Assembly (CLR) stored-procedure |
CS_IsAggregateFunction | IsAggregateFunction | SQL aggregate function |
CS_IsScalarFunction | IsScalarFunction | SQL scalar function |
CS_IsTableValuedFunction | IsTableValuedFunction | SQL table-valued-function |
CS_IsInlineTableValuedFunction | IsInlineTableValuedFunction | SQL inline table-valued function |
CS_IsMultiStatementTableValuedFunction | IsMultiStatementTableValuedFunction | SQL multi statement table-valued function |
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.