Updated to pass through one-to-one elements and schema attributes.

This commit is contained in:
af 2008-02-28 14:56:05 +00:00
parent 9ecbfb2f91
commit 97c62d4c86
3 changed files with 45 additions and 19 deletions

View file

@ -8,9 +8,9 @@
Transform ADL into (partial) controller classes
$Author: sb $
$Revision: 1.4 $
$Date: 2008-02-08 10:46:43 $
$Author: af $
$Revision: 1.5 $
$Date: 2008-02-28 14:56:05 $
-->
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -44,13 +44,13 @@
<!-- Ignore entities without a simple (non-composite) key. -->
</xsl:template>
<xsl:template match="a:entity[form|page|list]">
<xsl:template match="a:entity[a:form|a:page|a:list]">
<!-- what's all this about? the objective is to get the revision number of the
transform into the output, /without/ getting that revision number overwritten
with the revision number of the generated file if the generated file is
stored to CVS -->
<xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.4 $', 11)"/>
select="substring( '$Revision: 1.5 $', 11)"/>
<xsl:variable name="transform-revision"
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
@ -296,7 +296,7 @@ namespace <xsl:value-of select="$controllerns"/> {
InternalShowList();
</xsl:when>
<xsl:otherwise>
Redirect( FormsAuthentication.DefaultUrl);
RedirectToUrl( FormsAuthentication.DefaultUrl);
</xsl:otherwise>
</xsl:choose>
}
@ -327,7 +327,7 @@ namespace <xsl:value-of select="$controllerns"/> {
</xsl:for-each>.List&lt;<xsl:value-of select="@name"/>&gt;();
PropertyBag["instances"] =
PaginationHelper.CreatePagination( this, instances, 25);
PaginationHelper.CreatePagination( Context, instances, 25);
RenderViewWithFailover(view);
}
@ -348,6 +348,8 @@ namespace <xsl:value-of select="$controllerns"/> {
</xsl:template>
<xsl:template match="a:entity"/>
<!-- suppress properties otherwise -->
<xsl:template match="a:property"/>

View file

@ -8,8 +8,8 @@
Transform ADL into entity classes
$Author: af $
$Revision: 1.2 $
$Date: 2008-01-31 12:34:21 $
$Revision: 1.3 $
$Date: 2008-02-28 14:56:05 $
-->
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -48,7 +48,7 @@
stored to CVS -->
<xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.2 $', 11)"/>
select="substring( '$Revision: 1.3 $', 11)"/>
<xsl:variable name="transform-revision"
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
@ -146,7 +146,7 @@
}
}
<xsl:apply-templates select="a:key/a:property|a:property|a:set"/>
<xsl:apply-templates select="a:key/a:property|a:property|a:set|a:one-to-one"/>
}
}
@ -289,6 +289,18 @@
</xsl:template>
<xsl:template match="a:one-to-one">
// auto generating for one-to-one with name <xsl:value-of select="@name"/>
private <xsl:value-of select="@class"/><xsl:text> </xsl:text>_<xsl:value-of select="@name"/>;
public virtual <xsl:value-of select="@class"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
{
get { return _<xsl:value-of select="@name"/>; }
set { _<xsl:value-of select="@name"/> = value; }
}
</xsl:template>
<xsl:template match="a:set[a:many-to-many]">
// auto generating for set with name <xsl:value-of select="@name"/>, having many-to-many child
private ICollection&lt;<xsl:value-of
@ -299,7 +311,7 @@
get { return _<xsl:value-of select="@name"/>; }
set { _<xsl:value-of select="@name"/> = value; }
}
</xsl:template>
<xsl:template match="a:set[a:one-to-many]">
@ -375,4 +387,4 @@
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="urn:nhibernate-mapping-2.2"
@ -15,14 +15,14 @@
Most defaults are replaced with their actual values.
$Author: af $
$Revision: 1.1 $
$Revision: 1.2 $
-->
<xsl:output indent="no" method="xml" encoding="utf-8"/>
<xsl:template match="a:application">
<hibernate-mapping>
<xsl:apply-templates select="@namespace|@assembly" />
<xsl:apply-templates select="@namespace|@assembly|@schema" />
<xsl:comment>
***************************************************************************
*
@ -31,7 +31,7 @@
* THIS FILE IS AUTOMATICALLY GENERATED AND SHOULD NOT
* BE MANUALLY EDITED.
*
* Generated using adl2hibernate-mapping.xsl revision <xsl:value-of select="substring('$Revision: 1.1 $', 12)"/>
* Generated using adl2hibernate-mapping.xsl revision <xsl:value-of select="substring('$Revision: 1.2 $', 12)"/>
*
***************************************************************************
</xsl:comment>
@ -43,7 +43,7 @@
<class>
<xsl:apply-templates select="@name|@table" />
<xsl:apply-templates select="a:key" />
<xsl:apply-templates select="a:property|a:set|a:bag|a:subclass|a:component|a:discriminator" />
<xsl:apply-templates select="a:property|a:set|a:bag|a:subclass|a:component|a:discriminator|a:one-to-one" />
</class>
</xsl:template>
@ -160,6 +160,12 @@
</one-to-many>
</xsl:template>
<xsl:template match="a:one-to-one">
<one-to-one>
<xsl:apply-templates select="@*|node()" />
</one-to-one>
</xsl:template>
<xsl:template match="a:many-to-many">
<many-to-many>
<xsl:apply-templates select="@*|node()" />
@ -172,6 +178,12 @@
</generator>
</xsl:template>
<xsl:template match="a:param">
<param>
<xsl:apply-templates select="@*|node()" />
</param>
</xsl:template>
<xsl:template name="type-spec">
<xsl:param name="typename"/>
<xsl:param name="nullable" select="false()"/>
@ -201,4 +213,4 @@
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>