My MyGeneration project for ASP.NET template had invalid(I've created a copy of template instance) foreign key names for the table and it caused
**ERROR*** [NullReferenceException] Object reference not set to an instance of an object.
Canceled Template execution: EntitySpaces C# ASPX Page.
I would prefer to see mote detailed(with full call stack) message from MyGeneration.
To improve error handling it is required to add "not null check" in a few places in the code of EntitySpaces_C#_ASPX.csgen /EntitySpaces_C#_ASCX.csgen like the following(my changes are in
bold)
// Lookups section
IForeignKey fk = table.ForeignKeys[fkName];
if(fk!=null) //mnf
{//mnf
Dnp.Utils.TableRelation tr = new Dnp.Utils.TableRelation(table, fk);
%>
this.vlnk<%=esPlugIn.PropertyName(col)%>.Text = <%=tr.LookupName%>(entity.<%=esPlugIn.PropertyName(tr.PrimaryColumns[0])%>);
this.vlnk<%=esPlugIn.PropertyName(col)%>.NavigateUrl = Globals.ApplicationPath + "/tabid/" + TabId + "/pagename/<%=esPlugIn.Entity(tr.ForeignTable)%>/<%=esPlugIn.PropertyName(tr.ForeignColumns[0])%>/" + entity.str.<%=esPlugIn.PropertyName(tr.PrimaryColumns[0])%> + "/default.aspx";<%
}//mnf
I understand, that in ES2008 the template suite will be completely different, but this post could help someone in the meantime.
Michael Freidgeim
Blog:
http://geekswithblogs.net/mnf/