This is the location of the most up-to-date version of the unofficial Oracle Schema Provider for CodeSmith. Thanks goes out to Michael Toscano (aka VikingCoder) for starting a new Oracle provider based solely on the System.Data.OracleClient namespace.
To "install" the provider, just copy the following files to your C:\Program Files\CodeSmith\v2.5 (or equivalent) folder:
- SchemaExplorer.OracleNativeSchemaProvider.dll
- SchemaExplorer.OracleNativeSchemaProvider.dll.config
The DLL is built against the final release of CodeSmith 2.5. You shouldn't have to rebuild it.
RANDOM NOTES:
The CommandSchema objects returned from the provider will now have the following properties:
- CS_ObjectType (i.e "PACKAGE")
- CS_Status (i.e. "VALID", "INVALID")
- CS_ObjectId (OBJECT_ID of PACKAGE where command resides)
- CS_OverloadNumber (will be -1 if no overload exists, or a number > 0 if overloads are present)
- CS_FullName (will contain the original "raw" command name prefixed with the owner).
- CS_Name (will contain the original "raw" command name)
To support overloads in Oracle, the provider reports the Command.Name property as CUSTOMER.MODIFY[1], CUSTOMER.MODIFY[2], and so on. What this means is that in order for you to write templates that will handle overloaded Oracle procedures correctly, you'll need to use the CS_Name extended property value of the CommandSchema object instead of the Name property.
I have added support for SQL Server-like extended properties through creation of a CODESMITH_EXTENDED_PROPERTIES table (which is automatically excluded from the list returned by GetTables, by the way). This is a very powerful feature and I have already started putting it to great use for allowing fine grained control of certain aspects of my PL/SQL generation process (i.e. defining lookup tables and columns, being able to exclude certain columns from all procedure signatures, like CREATEDATE and MODIFIEDDATE, and to provide defaults for those values when they're excluded). The possibilities are endless.
I have also added support for a custom configuration file for use with the DLL to configure the behavior of the most critical parts of the provider. By default it takes the most conservative approach (no extended properties support). This is what it looks like:
<?
xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- Indicates the schema in which the CODESMITH_EXTENDED_PROPERTIES table should reside.
Comment out this entry to always use current user's schema -->
<!--
<add key="ExtendedPropertiesTableOwner" value="SYSTEM" />
-->
<!-- Indicates whether or not the provider should automatically create the extended properties table.
Setting this to true creates the table in the schema specified by the 'ExtendedPropertiesTableOwner'
value above, or the current user's schema if value isn't present -->
<add key="AutoCreateExtendedPropertiesTable" value="false" />
<!-- Specifies whether to show user owned objects only. -->
<add key="ShowMySchemaOnly" value="true" />
<!-- Specifies whether to allow schema provider to execute procedures that return REF CURSORs to determine
the column schema information. Allowing this can result in a change in the state of the database due to
things like explicit transaction handling in PL/SQL or usage of a sequence's 'nextval' property. -->
<add key="AllowGetCommandResultSchemas" value="false" />
</appSettings>
</configuration>
You can enable extended property support by allowing the schema provider to go ahead and create the CODESMITH_EXTENDED_PROPERTIES table if it is not present, and yet still control where it gets created and used from. It also allows you to easily filter the "visible" schema objects to just the ones you own directly. And of course, it allows you to decide whether or not to allow the provider to execute procedures (wrapped in transactions that get rolled back) to derive the command results. By default this behavior is disabled.
Revision History:
2/2/2004 - First release.
2/3/2004 - Fixed a bug in GetCommandParameters related to procedure overload handling
2/27/2004 - Added the user name (if present in the connect string) to the value return by the GetDatabaseName method.
10/2/2004 - Attached a version of this provider compiled for CodeSmith 2.6 (OracleNativeSchemaProvider_26.zip).
Post Edited By Moderator (ejsmith) : 6/13/2005 7:13:07 PM GMT