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

View file

@ -8,8 +8,8 @@
Transform ADL into entity classes Transform ADL into entity classes
$Author: af $ $Author: af $
$Revision: 1.2 $ $Revision: 1.3 $
$Date: 2008-01-31 12:34:21 $ $Date: 2008-02-28 14:56:05 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -48,7 +48,7 @@
stored to CVS --> stored to CVS -->
<xsl:variable name="transform-rev1" <xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.2 $', 11)"/> select="substring( '$Revision: 1.3 $', 11)"/>
<xsl:variable name="transform-revision" <xsl:variable name="transform-revision"
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/> 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>
<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]"> <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 // auto generating for set with name <xsl:value-of select="@name"/>, having many-to-many child
private ICollection&lt;<xsl:value-of private ICollection&lt;<xsl:value-of

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