Tactical commit point: everything is working using Andrew's new TypedPropertyBag, but not yet exploiting SmartFormHelper
This commit is contained in:
parent
dff905227d
commit
7673552477
|
@ -9,8 +9,8 @@
|
||||||
Transform ADL into (partial) controller classes
|
Transform ADL into (partial) controller classes
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.26 $
|
$Revision: 1.27 $
|
||||||
$Date: 2008-05-15 16:29:24 $
|
$Date: 2008-05-16 11:12:48 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
//
|
//
|
||||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||||
// Automatically generated from application description using
|
// Automatically generated from application description using
|
||||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.26 $', 10)"/>
|
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.27 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
|
@ -128,7 +128,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
//
|
//
|
||||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||||
// Automatically generated from application description using
|
// Automatically generated from application description using
|
||||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.26 $', 10)"/>
|
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.27 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
|
@ -171,7 +171,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
ControllerDetails("<xsl:value-of select="@name"/>", Area = "<xsl:value-of select="$area-name"/>"),
|
ControllerDetails("<xsl:value-of select="@name"/>", Area = "<xsl:value-of select="$area-name"/>"),
|
||||||
Helper(typeof(<xsl:value-of select="concat( @name, 'FieldHelper')"/>), "<xsl:value-of select="concat( @name, 'FieldHelper')"/>")
|
Helper(typeof(<xsl:value-of select="concat( @name, 'FieldHelper')"/>), "<xsl:value-of select="concat( @name, 'FieldHelper')"/>")
|
||||||
]
|
]
|
||||||
public partial class <xsl:value-of select="concat( @name, 'Controller')"/>Controller : <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/> {
|
public partial class <xsl:value-of select="concat( @name, 'Controller')"/> : <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/> {
|
||||||
|
|
||||||
/* The SmartFormHelper stuff in generated controller classes does not yet work. There is some
|
/* The SmartFormHelper stuff in generated controller classes does not yet work. There is some
|
||||||
* hope that in future it will offer definite benefits and in the mean time it is doing no harm.
|
* hope that in future it will offer definite benefits and in the mean time it is doing no harm.
|
||||||
|
@ -443,12 +443,6 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
AddError( axe.Message);
|
AddError( axe.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyBag["messages"] = messages;
|
|
||||||
PropertyBag["instance"] = record;
|
|
||||||
<xsl:if test="$authentication-layer = 'Database'">
|
|
||||||
PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN];
|
|
||||||
</xsl:if>
|
|
||||||
|
|
||||||
if ( ! HasNoErrors())
|
if ( ! HasNoErrors())
|
||||||
{
|
{
|
||||||
/* the session may be polluted; create a new session */
|
/* the session may be polluted; create a new session */
|
||||||
|
@ -459,9 +453,17 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
record = FetchRecord( hibernator);
|
record = FetchRecord( hibernator);
|
||||||
} /* if ( ! HasNoErrors()) */
|
} /* if ( ! HasNoErrors()) */
|
||||||
<xsl:call-template name="formmenus">
|
|
||||||
<xsl:with-param name="form" select="adl:form[position()=1]"/>
|
TypedPropertyBag = new {
|
||||||
</xsl:call-template>
|
<xsl:call-template name="formmenus">
|
||||||
|
<xsl:with-param name="form" select="adl:form[position()=1]"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:if test="$authentication-layer = 'Database'">
|
||||||
|
username = Session[ NHibernateHelper.USERTOKEN],
|
||||||
|
</xsl:if>
|
||||||
|
messages = messages,
|
||||||
|
instance = record };
|
||||||
|
|
||||||
RenderViewWithFailover("<xsl:value-of select="concat( adl:form[position()=1]/@name, '.vm')"/>",
|
RenderViewWithFailover("<xsl:value-of select="concat( adl:form[position()=1]/@name, '.vm')"/>",
|
||||||
"<xsl:value-of select="concat( adl:form[position()=1]/@name, '.auto.vm')"/>");
|
"<xsl:value-of select="concat( adl:form[position()=1]/@name, '.auto.vm')"/>");
|
||||||
}
|
}
|
||||||
|
@ -676,10 +678,11 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record = FetchRecord( hibernator);
|
<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record = FetchRecord( hibernator);
|
||||||
|
|
||||||
|
TypedPropertyBag = new {
|
||||||
<xsl:if test="$authentication-layer = 'Database'">
|
<xsl:if test="$authentication-layer = 'Database'">
|
||||||
PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN];
|
username = Session[ NHibernateHelper.USERTOKEN],
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
PropertyBag["instance"] = record;
|
instance = record };
|
||||||
|
|
||||||
RenderViewWithFailover( "maybedelete.vm", "maybedelete.auto.vm");
|
RenderViewWithFailover( "maybedelete.vm", "maybedelete.auto.vm");
|
||||||
}
|
}
|
||||||
|
@ -704,13 +707,17 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
ISession hibernator =
|
ISession hibernator =
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||||
<xsl:call-template name="formmenus">
|
|
||||||
<xsl:with-param name="form" select="."/>
|
|
||||||
</xsl:call-template>
|
|
||||||
|
|
||||||
<xsl:if test="$authentication-layer = 'Database'">
|
TypedPropertyBag = new {
|
||||||
PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN];
|
<xsl:if test="$authentication-layer = 'Database'">
|
||||||
</xsl:if>
|
username = Session[ NHibernateHelper.USERTOKEN],
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:call-template name="formmenus">
|
||||||
|
<xsl:with-param name="form" select="."/>
|
||||||
|
</xsl:call-template>
|
||||||
|
lastentry = "trailing-comma-avoidance" /* yes, it's a hack */
|
||||||
|
};
|
||||||
|
|
||||||
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>",
|
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>",
|
||||||
"<xsl:value-of select="concat( @name, '.auto.vm')"/>");
|
"<xsl:value-of select="concat( @name, '.auto.vm')"/>");
|
||||||
}
|
}
|
||||||
|
@ -796,14 +803,15 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
.UniqueResult<<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>>();
|
.UniqueResult<<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>>();
|
||||||
|
|
||||||
|
TypedPropertyBag = new {
|
||||||
<xsl:if test="$authentication-layer = 'Database'">
|
<xsl:if test="$authentication-layer = 'Database'">
|
||||||
PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN];
|
username = Session[ NHibernateHelper.USERTOKEN],
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
PropertyBag["instance"] = record;
|
|
||||||
|
|
||||||
<xsl:call-template name="formmenus">
|
<xsl:call-template name="formmenus">
|
||||||
<xsl:with-param name="form" select="."/>
|
<xsl:with-param name="form" select="."/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
|
instance = record };
|
||||||
|
|
||||||
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>", "<xsl:value-of select="concat( @name, '.auto.vm')"/>");
|
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>", "<xsl:value-of select="concat( @name, '.auto.vm')"/>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,8 +981,8 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
<xsl:template name="menu">
|
<xsl:template name="menu">
|
||||||
<xsl:param name="property"/>
|
<xsl:param name="property"/>
|
||||||
<xsl:variable name="entity" select="//adl:entity[@name=$property/@entity]"/>
|
<xsl:variable name="entity" select="//adl:entity[@name=$property/@entity]"/>
|
||||||
PropertyBag["<xsl:value-of select="concat('all_', $property/@name)"/>"] =
|
<xsl:value-of select="concat('all_', $property/@name)"/> =
|
||||||
<xsl:value-of select="concat( 'FetchAll', $entity/@name)"/>( NHibernateHelper.GetCurrentSession());
|
<xsl:value-of select="concat( 'FetchAll', $entity/@name)"/>( NHibernateHelper.GetCurrentSession()),
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="primary-key-csharp-type">
|
<xsl:template name="primary-key-csharp-type">
|
||||||
|
|
Loading…
Reference in a new issue