AnantLabs / codesmith

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

Entity class generation produces corrupt code when using additional properties (tested in VB) #597

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have only tried this in VB, not tested C#

What steps will reproduce the problem?
1. Generate entities from database
2. Edit one of the entities and create an additional property which has a line 
break within a LIQ statement (sample below)
3. Generate code again - the class will be screwed, repeated metadata class, 
existing code broken mid line (the rest pushed down).

I guess there is an issue parsing existing code to work out where to put the 
generated code. Using a continuation character (_) is fine.

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

The class is screwed. Manually tidying up then rebuilding the project will 
regenerate the corrupt code [repeat]

What version of the product are you using?

PLINQO-v5.0.3.2028, Codesmith Pro 5.3.3 12729

Please provide any additional information below.

Removing the line break in the LINQ fixes the issue.

Example which will cause the issue to occur:

    Partial Public Class ManufacturerConsignment

        ' For more information about the features contained in this class, please visit our GoogleCode Wiki at...
        ' http://code.google.com/p/codesmith/wiki/PLINQO
        ' Also, you can watch our Video Tutorials at...
        ' http://community.codesmithtools.com/

        Public ReadOnly Property TotalVolume As Double
            Get
                Return (From mci In McManufacturerConsignmentItemList
                        Select mci.PiProductItem.PtProductType.Volume).Sum ' Note the line break before Select
            End Get
        End Property

Whereas this is fine...

        Public ReadOnly Property TotalVolume As Double
            Get
                Return (From mci In McManufacturerConsignmentItemList Select mci.PiProductItem.PtProductType.Volume).Sum ' Note there is no line break
            End Get
        End Property

And so is this (note the continuation _)

        Public ReadOnly Property TotalVolume As Double
            Get
                Return (From mci In McManufacturerConsignmentItemList _
                        Select mci.PiProductItem.PtProductType.Volume).Sum
            End Get
        End Property

Original issue reported on code.google.com by jer...@goldfigure.co.uk on 21 Jul 2011 at 4:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 25 Jul 2011 at 6:58

GoogleCodeExporter commented 9 years ago
We are looking into this issue, in the mean time please continue to use the 
proposed workaround.

Original comment by bniemyjski on 25 Jul 2011 at 7:11

GoogleCodeExporter commented 9 years ago
Yeah, figured. :)

It's only because VB is so slack with standards. Dropping the _ is a stupid 
idea, but it's a corner I got used to cutting. :)

JB

Original comment by jer...@goldfigure.co.uk on 25 Jul 2011 at 8:14

GoogleCodeExporter commented 9 years ago
I agree :)

Original comment by bniemyjski on 26 Jul 2011 at 10:06

GoogleCodeExporter commented 9 years ago
Hello,

We are going to change this in the next released version of the templates.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 22 Aug 2011 at 3:01

GoogleCodeExporter commented 9 years ago
Cool, there is no hurry my end. I'm just coding better (see my July 25 comment).

Original comment by jer...@goldfigure.co.uk on 22 Aug 2011 at 3:05