I don't know if it can be used. I think there are only two types of providers, one is sqlschemaprovider and the other is adoxschemaprovider. After the template is written, an error is prompted during compilation,
The project cannot be found in the set of names or ordinal numbers.
An error of type "comexception"
Occured while attempting to execute this template. To enable
Just-in-time debugging on this template set the "debug" attribute
"True" in the "codetemplate" directive and add a "Debugger. Break ()"
Statement in the template.
The following is my Template
<% @ Codetemplate Language = "C #" targetlanguage = "T-SQL"
Description = "generates a update stored procedure." %>
<% @ Property name = "sourcetable" type = "schemaexplorer. tableschema"
Category = "context"
Description = "table that the stored procedures shoshould be based on." %>
<% @ Assembly name = "schemaexplorer" %>
<% @ Import namespace = "schemaexplorer" %>
<SCRIPT runat = "template">
Public String getsqlparameterstatement (columnschema column)
{
String Param = "@" + column. Name + "" + column. nativetype;
Switch (column. datatype)
{
Case dbtype. Decimal:
{
Param + = "(" + column. Precision + "," + column. Scale + ")";
Break;
}
Default:
{
If (column. size> 0)
{
Param + = "(" + column. Size + ")";
}
Break;
}
}
Return Param;
}
</SCRIPT>
-----------------------------------------------------------------
-- Date created: <% = datetime. Now. tolongdatestring () %>
-- Created by: generated by codesmith
-----------------------------------------------------------------
Create procedure DBO. Update <% = sourcetable. name %>
<% For (INT I = 0; I <sourcetable. Columns. Count; I ++) {%>
<% =
Getsqlparameterstatement (sourcetable. Columns [I]) %> <% if (I <
Sourcetable. Columns. Count-1) {%>,<%}%>
<% }%>
As
Update [<% = sourcetable. name %>] Set
<% For (INT I = 0; I <sourcetable. nonprimarykeycolumns. Count; I ++) {%>
[<% =
Sourcetable. nonprimarykeycolumns [I]. name %>] =@<%=
Sourcetable. nonprimarykeycolumns [I]. name %> <% if (I <
Sourcetable. nonprimarykeycolumns. Count-1) {%>,<%}%>
<% }%>
Where
<% For (INT I = 0; I <sourcetable. primarykey. membercolumns. Count; I ++) {%>
<% If (I> 0) {%> and <%} %>
[<% =
Sourcetable. primarykey. membercolumns [I]. name %>] =@<%=
Sourcetable. primarykey. membercolumns [I]. name %>
<% }%>
The SQL Server has passed. Oracle prompts the above error.