From ae4e125b994dd38b875a5e723d65733935164184 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 11 Feb 2008 15:35:42 +0000 Subject: [PATCH] adl2controllerclasses currently breaking. --- transforms01/adl2controllerclasses.xslt | 128 +++++++++++++++--------- 1 file changed, 78 insertions(+), 50 deletions(-) diff --git a/transforms01/adl2controllerclasses.xslt b/transforms01/adl2controllerclasses.xslt index 4ca99ca..061c382 100755 --- a/transforms01/adl2controllerclasses.xslt +++ b/transforms01/adl2controllerclasses.xslt @@ -9,8 +9,8 @@ Transform ADL into (partial) controller classes $Author: sb $ - $Revision: 1.3 $ - $Date: 2008-02-06 17:24:53 $ + $Revision: 1.4 $ + $Date: 2008-02-11 15:35:42 $ --> + select="substring( '$Revision: 1.4 $', 11)"/> - + -/* ---- [ cut here: next file 'Controller.auto.cs'] ---------------- */ + /* ---- [ cut here: next file 'Controller.auto.cs'] ---------------- */ //------------------------------------------------------------------ // @@ -163,7 +163,9 @@ namespace { record = hibernator.CreateCriteria(typeof()) - .Add(Expression.Eq("", Int32.Parse(id))) + .Add(Expression.Eq("", (( + + ))) .UniqueResult<>(); } @@ -179,11 +181,16 @@ namespace { * special - BindObjectInstance /should/ do it all. Unfortunately it sometimes * doesn't, and I haven't yet characterised why not. */ + + + + + record. = hibernator.CreateCriteria(typeof()) .Add(Expression.Eq(" - - ", Int32.Parse(Form[""]))) + + ", (()Form[""]))) .UniqueResult<>(); @@ -208,10 +215,9 @@ namespace { /* then reinstate the values from the indexes passed */ foreach ( string index in ) { - .Add( hibernator.CreateCriteria(typeof()) - .Add(Expression.Eq("Id", Int32.Parse(index))) + .Add(Expression.Eq("Id", index)) .UniqueResult<.>()); } } @@ -227,7 +233,7 @@ namespace { /* updating child records; first remove any not on the submitted list */ foreach ( item in record.) { - String itemId = item.Key.ToString(); + String itemId = item.KeyString; bool found = false; foreach ( string index in ) @@ -248,9 +254,12 @@ namespace { /* then add any on the included list which are not already members */ foreach ( string index in ) { + item = hibernator.CreateCriteria(typeof()) - .Add(Expression.Eq("Id", Int32.Parse(index))) + .Add(Expression.Eq("Id", (( + + )index))) .UniqueResult<.>(); if ( ! record..Contains( item)) @@ -319,7 +328,9 @@ namespace { { record = hibernator.CreateCriteria(typeof()) - .Add(Expression.Eq("", Int32.Parse(id))) + .Add(Expression.Eq("", (( + + ))) .UniqueResult<>(); if ( record != null) @@ -328,7 +339,9 @@ namespace { hibernator.Delete( hibernator.CreateCriteria(typeof()) - .Add(Expression.Eq("", Int32.Parse(id))) + .Add(Expression.Eq("", (( + + )id))) .UniqueResult<>()); hibernator.Flush(); @@ -412,14 +425,14 @@ namespace { - - - - - - - - + + + + + + + + /// <summary> /// Handle the submission of the form named @@ -427,14 +440,14 @@ namespace { [AccessibleThrough(Verb.Post)] public void ( ) { - string command = Form[ "command"]; - - if ( command == null) - { - throw new Exception( "No command?"); - } - else - + string command = Form[ "command"]; + + if ( command == null) + { + throw new Exception( "No command?"); + } + else + if ( command.Equals( "")) { /* NOTE: You must write an implementation of this verb in a @@ -454,9 +467,9 @@ namespace { PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN]; PropertyBag["instance"] = - hibernator.CreateCriteria(typeof()) - .Add(Expression.Eq("", Int32.Parse(id))) - .UniqueResult<>(); + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq("", id)) + .UniqueResult<>(); RenderViewWithFailover( "maybedelete.vm", "maybedelete.auto.vm"); } @@ -480,13 +493,14 @@ namespace { NHibernateHelper.GetCurrentSession( Session[ NHibernateHelper.USERTOKEN], Session[NHibernateHelper.PASSTOKEN]); - + PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN]; - RenderViewWithFailover("", ""); + RenderViewWithFailover("", + ""); } /// <summary> @@ -494,15 +508,15 @@ namespace { /// </summary> /// <param name="">the key value of the record to show</param> [AccessibleThrough(Verb.Get)] - public void ( Int32 ) + public void ( ) { ISession hibernator = NHibernateHelper.GetCurrentSession( Session[ NHibernateHelper.USERTOKEN], Session[NHibernateHelper.PASSTOKEN]); - record = - hibernator.CreateCriteria(typeof()) - .Add(Expression.Eq("", Id)) - .UniqueResult<>(); + record = + hibernator.CreateCriteria(typeof()) + .Add(Expression.Eq("", Id)) + .UniqueResult<>(); PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN]; @@ -567,23 +581,37 @@ namespace { .List<>(); + + + + + ADL: ERROR: entity '' has no primary key. + + + + + + + + + - + - - + + - + - + - ADL: WARNING: entity '' has a compound primary key; - adl2controllerclasses is not yet clever enough to generate appropriate code + ADL: WARNING: entity '' has a compound primary key; + adl2controllerclasses is not yet clever enough to generate appropriate code. - + @@ -593,10 +621,10 @@ namespace { - + - +