In a previous post I discussed an XSLT file which generates code to execute Stored Procedures on an SQL Server database using Entity Framework.
DataDirect produces an Entity Framework provider for Oracle databases, and I found that the same XSLT file also works for edmx files generated by DataDirect. The only difference I found was that output parameters are declared as
@Mode=”InOut”
in SQL Server, but as
@Mode=”Out”
in Oracle. Therefore, some adjustments to the file are necessary.
In the first for-each statement on edm:Parameter
<xsl:if test="position() != 1">, </xsl:if> <xsl:if test="@Mode = 'InOut' or @Mode = 'Out'">out </xsl:if>
in the second statement
par.DbType = System.Data.DbType.<xsl:value-of select="@Type" />;<xsl:if test="@Mode = 'InOut'"> par.Direction = System.Data.ParameterDirection.InputOutput; </xsl:if><xsl:if test="@Mode = 'Out'"> par.Direction = System.Data.ParameterDirection.Output;</xsl:if> <xsl:if test="@Mode != 'InOut' and @Mode != 'Out'">
and
<xsl:if test="@Mode = 'InOut' or @Mode = 'Out'"> par.Value = System.DBNull.Value; </xsl:if>
in the third statement
<xsl:if test="@Mode = 'InOut' or @Mode = 'Out'">
Modify the original XSLT in Visual Studio, select your edmx file as Input File, and execute.