diff --git a/transforms01/adl2controllerclasses.xslt b/transforms01/adl2controllerclasses.xslt index 7ede49a..4ca99ca 100755 --- a/transforms01/adl2controllerclasses.xslt +++ b/transforms01/adl2controllerclasses.xslt @@ -9,8 +9,8 @@ Transform ADL into (partial) controller classes $Author: sb $ - $Revision: 1.2 $ - $Date: 2008-02-01 21:47:15 $ + $Revision: 1.3 $ + $Date: 2008-02-06 17:24:53 $ --> - - + + + + + - + + + + + select="substring( '$Revision: 1.3 $', 11)"/> - + @@ -109,6 +121,8 @@ namespace { /// </summary> public partial class Controller : BaseController { + + /// <summary> /// Store the record represented by the parameters passed in an HTTP service /// Without Id -> it's new, I create a new persistent object; @@ -121,17 +135,18 @@ namespace { NHibernateHelper.GetCurrentSession( Session[ NHibernateHelper.USERTOKEN], Session[NHibernateHelper.PASSTOKEN]); List<string> messages = new List<string>(); - - . record; - - + . record; + + + + string id = Form[""]; if ( String.IsNullOrEmpty( id)) { /* it's new, create persistent object */ - record = new .(Form[] + record = new .(Form[] , @@ -145,6 +160,7 @@ namespace { else { /* it's existing, retrieve it */ + record = hibernator.CreateCriteria(typeof()) .Add(Expression.Eq("", Int32.Parse(id))) @@ -158,19 +174,20 @@ namespace { /* actually update the record */ BindObjectInstance( record, ParamStore.Form, "instance"); - + /* for properties of type 'entity', it should not be necessary to do anything * special - BindObjectInstance /should/ do it all. Unfortunately it sometimes - * doesn't, and I haven't yet characterised why not. TODO: Fix this! */ + * doesn't, and I haven't yet characterised why not. */ + record. = hibernator.CreateCriteria(typeof()) - .Add(Expression.Eq(" + .Add(Expression.Eq(" ", Int32.Parse(Form[""]))) .UniqueResult<>(); - + - + /* to update a link table which has no other data than the near and far keys, it is * sufficient to smash the existing values and create new ones. It's also a lot easier! */ @@ -198,9 +215,9 @@ namespace { .UniqueResult<.>()); } } - + - + /* with a list we cannot just smash the old values! Instead we need to check * each one and exclude it if no longer required */ if ( Form.GetValues( "") != null) @@ -242,7 +259,7 @@ namespace { } } } - + /* perform any domain knowledge behaviour on the record prior to updating */ record.BeforeUpdateHook( hibernator); @@ -267,21 +284,25 @@ namespace { PropertyBag["messages"] = messages; PropertyBag["instance"] = record; - + PropertyBag["username"] = Session[ NHibernateHelper.USERTOKEN]; - + - - - - RenderViewWithFailover("", ""); + + + + RenderViewWithFailover("", + ""); } else { throw new Exception( String.Format( "No record of type with key value {0} found", id)); } } + + + /// <summary> /// Actually delete the selected record /// </summary> @@ -317,21 +338,21 @@ namespace { throw new ApplicationException( "No such record?"); } } - - + + InternalShowList(); - - + + Redirect( FormsAuthentication.DefaultUrl); - - + + } + + - - - - - + + + /// <summary> /// list all instances of this entity to allow the user to select one for editing /// this method invokes the default list view - which is probably what you want unless @@ -363,13 +384,13 @@ namespace { PaginationHelper.CreatePagination( this, instances, 25); RenderViewWithFailover(view + ".vm", view + ".auto.vm"); - } + } } } - + if ( Form[ "" ] == null) { AddError( @@ -383,13 +404,13 @@ namespace { - + - + "" - + @@ -496,7 +517,7 @@ namespace { - + /// <summary> /// list all instances of this entity to allow the user to select one /// this method invokes the named view. @@ -508,22 +529,26 @@ namespace { + + /* */ + + - + /* produce a list of to populate the menu for */ - + /* produce a list of to populate the LHS of the shuffle for */ - + /* produce a list of to populate the multi-select for */ @@ -535,22 +560,48 @@ namespace { - + PropertyBag[""] = hibernator.CreateCriteria(typeof()) .List<>(); - + - - + + + + + + + + ADL: WARNING: entity '' has a compound primary key; + adl2controllerclasses is not yet clever enough to generate appropriate code + + + + + + - + + + + + + + + + + + + + + diff --git a/transforms01/adl2entityclass.xslt b/transforms01/adl2entityclass.xslt index b5c40c9..56e6cb9 100755 --- a/transforms01/adl2entityclass.xslt +++ b/transforms01/adl2entityclass.xslt @@ -8,8 +8,8 @@ Transform ADL into entity classes $Author: sb $ - $Revision: 1.3 $ - $Date: 2008-02-01 21:47:15 $ + $Revision: 1.4 $ + $Date: 2008-02-06 17:24:53 $ --> + + Matched entity with name @@ -50,7 +53,7 @@ stored to CVS --> + select="substring( '$Revision: 1.4 $', 11)"/> @@ -108,7 +111,7 @@ /* natural primary key exists - not generating abstract key */ - /* composite promary key exists - not generating abstract key */ + /* primary key exists - not generating abstract key */ /// <summary> /// Auto-generated constructor; initialises each of the slots within diff --git a/transforms01/adl2mssql.xslt b/transforms01/adl2mssql.xslt index b8192c6..d4bffbc 100755 --- a/transforms01/adl2mssql.xslt +++ b/transforms01/adl2mssql.xslt @@ -12,17 +12,26 @@ Convert ADL to MS-SQL $Author: sb $ - $Revision: 1.3 $ + $Revision: 1.4 $ --> - + + + + ------------------------------------------------------------------------------------------------- -- -- Database for application version - -- Generated for MS-SQL 2000+ using adl2mssql.xsl $Revision: 1.3 $ + -- Generated for MS-SQL 2000+ using adl2mssql.xsl $Revision: 1.4 $ -- -- Code generator (c) 2007 Cygnet Solutions Ltd -- @@ -46,7 +55,7 @@ ------------------------------------------------------------------------------------------------- -- primary referential integrity constraints ------------------------------------------------------------------------------------------------- - + @@ -116,10 +125,12 @@ GO + + - - + ------------------------------------------------------------------------------------------------- - -- primary table + -- primary table ------------------------------------------------------------------------------------------------- - CREATE TABLE "" + CREATE TABLE "" ( , @@ -376,7 +387,12 @@ - INT IDENTITY( 1, 1) + + + INT IDENTITY( 1, 1) + + ADL: WARNING: type='serial' is deprecated; add a generator with type='native' instead + @@ -387,6 +403,11 @@ + + + + + @@ -400,7 +421,7 @@ - "" " NOT NULL DEFAULT @@ -418,17 +439,74 @@ sure why. So temporarily this special case template fixes the problem. TODO: work out what's wrong with the grand unified version --> + + + + + - "" " DEFAULT NOT NULL + + + + + + + + + + + + + + + + + + + + + + + + + ADL: WARNING: entity '' has a compound primary key; + adl2mssql is not yet clever enough to generate appropriate code + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/transforms01/adl2views.xslt b/transforms01/adl2views.xslt index ddd7f92..7c9045e 100755 --- a/transforms01/adl2views.xslt +++ b/transforms01/adl2views.xslt @@ -9,8 +9,8 @@ Transform ADL into velocity view templates $Author: sb $ - $Revision: 1.1 $ - $Date: 2008-01-31 17:06:35 $ + $Revision: 1.2 $ + $Date: 2008-02-06 17:24:53 $ --> @@ -31,7 +31,7 @@ stored to CVS --> + select="substring( '$Revision: 1.2 $', 11)"/> @@ -45,6 +45,9 @@ + + +