AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

CSLA TEMPLATES - Output with only NameValueList's will raise exception and reset to default selections #612

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a database with two tables A and B.
2. Using Quickstart, generate solution for this database
3. Edit the Codesmith output, add ^dbo.B to the ignore list
4. Add a NameValueList for A
5. Remove the selections for all other entities (so all we should be generating 
is the NVL for A)
6. Save the current state of the output
7. Re-open the Codesmith output, error occurs (see below) and the previous 
configuration of the output is lost.

What is the expected output? What do you see instead?
If I generate instead of trying to reopen the Codesmith output then there is no 
obvious indication that the exception has occurred.  My output is reset and I 
produce entities for B.  Even though I have B in my ignore list.

What version of the product are you using?
Professional 5.3.4 Revision 12823

Please provide any additional information below.
I have attached my generated solution which includes a database creation script.

The exception that is thrown is:
System.Reflection.TargetInvocationException: Exception has been thrown by the 
target of an invocation. ---> System.NullReferenceException: Object reference 
not set to an instance of an object.
   at CodeSmith.QuickStart.EntityMasterCodeTemplate.PopulateDefaultTables()
   at CodeSmith.QuickStart.EntityMasterCodeTemplate.OnDatabaseChanged()
   at CodeSmith.QuickStart.QuickStartCodeTemplate.set_SourceDatabase(DatabaseSchema value)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
   at CodeSmith.Engine.CodeTemplate.SetProperty(PropertyInfo propertyInfo, Object value)
   at CodeSmith.Engine.CodeTemplate.SetProperty(String name, Object value)
   at CodeSmith.Engine.CodeTemplate.SetProperty(XmlNode propertyNode, String baseDirectory)
   at CodeSmith.Engine.CodeTemplate.RestorePropertiesFromXml(String xmlFragment, String baseDirectory)
   at CodeSmith.Engine.CodeTemplate.RestorePropertiesFromPropertySet(PropertySet propertySet, String baseDirectory)
   at CodeSmith.Gui.AddOutput.a(String A_0)

Original issue reported on code.google.com by ianmcdid...@gmail.com on 25 Nov 2011 at 10:23

GoogleCodeExporter commented 9 years ago
Forgot to attach solution zip

Original comment by ianmcdid...@gmail.com on 25 Nov 2011 at 10:40

Attachments:

GoogleCodeExporter commented 9 years ago
Hello,

Thank you so much for the steps and samples. I've been able to reproduce this 
behavior where the tables are added back for generation. I'll be working on the 
CSLA templates as soon as Generator 6.0 is released and will make sure this is 
fixed in a nightly. 

I also wanted to let you know that I haven't been able to reproduce this 
exception in CodeSmith Generator 6.0 and recommend updating to 6.0 when it is 
released.

Also, what kind of customizations have you made to the templates? Would you 
mind sharing.

Original comment by bniemyjski on 28 Nov 2011 at 2:44

GoogleCodeExporter commented 9 years ago
My customizations are quick fixes that I needed for my current project.  I 
would share if there was anything worthwhile, but they are dirty changes to 
get me out of a hole rather than improvements..

- I use Windows Forms, so want to use BusinessBindingListBase over 
BusinessListBase.
- I am using guids as my primary key.  The NameValueList template assumes 
int's, so changed this.
- In DataAccess templates an exception is thrown when a Fetch does not find 
any data.  I wanted to throw a "NoMatchingData" exception that the 
application will recognise rather than a the base Exception class that could 
be raised for any number of reasons.

Thanks for having a look at my problems, looking forward to 6.0.

Ian

Original comment by ianmcdid...@gmail.com on 28 Nov 2011 at 5:00

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 9 Mar 2012 at 1:15

GoogleCodeExporter commented 9 years ago
We'd love to see your changes. Please just create a new issue here on the issue 
tracker with a zip or patch :)..

This behavior has been fixed / resolved in the latest nightly build of the 
templates.

Original comment by bniemyjski on 9 Mar 2012 at 1:56