AnantLabs / codesmith

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

Use of MarkAsChild in EditableChild constructor #512

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Generate any editable child class for CSLA.

What is the expected output? What do you see instead?

Since DataPortal marks children, my expectation was that it needn't 
(shouldn't??) be done in the constructor, too.  In other words, I was surprised 
by the presence of the MarkAsChild() call in the generated code.  In the last 
small CSLA project I built by hand (before I became a CodeSmith user), I 
omitted this without a problem (even though I do NOT implement the 
dataportal_Create method).  So I believed it was correct to omit it as Rocky's 
stereotype code sample does (see Editable Child Business Objects starting page 
173 of VB2008 BusnObj, in particular the constructor code at the top of page 
175).

Blake asked me to submit this so that you could review whether or not it is 
desirable to include the setting here.

What version of the product are you using?
5.2.2 - CSLA 3.8.3 templates

Please provide any additional information below.

Original issue reported on code.google.com by RQJohnso...@gmail.com on 4 Oct 2010 at 7:59

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 5 Oct 2010 at 10:33

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 5 Oct 2010 at 10:34

GoogleCodeExporter commented 9 years ago
Hello,

So I took a look into this and refreshed why this is the case. So there are two 
reasons that this code is in their. The first is that we call this constructor 
when we create a new business object to a list like an EditableRootList. The 
second reason is we needed a private constructor to mark it as child when we 
used the ObjectFactory Implementation.

Upon further look, I think that this is going to need a rewrite as a better 
solution has to exist. Do you have any ideas? You can't populate the object 
inside of the static factory method so that removes that option to call 
MyClass.NewMyClass(reader).

In an overview we need to create a new object and populate it from object 
factory and from inside of a List Business Object. I'm open to ideas.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 20 Nov 2010 at 12:48

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r2539.

Fixed a bug with the use of MarkAsChild in EditableChild constructor.
Fixed a bug where set statements would be generated incorrectly.
Updated the constructors and map methods to use FetchChild.

Original comment by bniemyjski on 13 Mar 2012 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 13 Mar 2012 at 4:19