Bug when generating code for the default value of an Enum

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
crazypit
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Bug when generating code for the default value of an Enum

Post by crazypit » Thu 29 Dec 2011 13:02

Hello,

Using the latest version of LinqConnect, for some Enum-typed properties that a default value is specified, the generated code is falsely broken in 2 lines e.g. as follows:

private CompanySubtypeEnum _Subtype = (CompanySubtypeEnum)Enum.Parse(typeof(CompanySubtypeEnum), "1
");

First line goes up to and the rest goes to a second line that brakes the code.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 30 Dec 2011 18:15

We couldn't reproduce the problem in our environment. Could you please specify the code generation template you are using (e.g., is it 'LinqConnect', 'POCO', 'Fluent Mapping' or a custom one)?

crazypit
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Post by crazypit » Mon 02 Jan 2012 07:56

I know it's a bit odd, but it's true! And it is very annoying because i used to generate code in my project folder and now i switched back to generating the code to an other folder and copy only the entities that changed, because the number of broken files is too big to fix it by hand.

The template is the LinqConnect C#. I generate each entity per file. I don't know if this helps, and is a bit odd, but for a property that the default enum value is '0' everything works as expected! Only for the ones that the default value is '1' it brakes.

crazypit
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Post by crazypit » Mon 02 Jan 2012 08:22

I found the cause of the bug. In the lqml xml file, the default value attribute was saved as :

DefaultValue="1
"

instead of DefaultValue="1". I don't know how this ended up in there! In the entity developer designer, the default value property looks correctly to be '1'. Maybe after the first Update Model from Database, when the new property or entire class is generated for the first time? It seems to be it. Anyway, i replaced all the aforementioned instances in the text file, and everything works ok now.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Mon 09 Jan 2012 15:47

Sorry for the delay. We have reproduced the issue, and will post here when it is fixed.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 28 Feb 2012 16:22

The fix for this issue is available in the new 3.1.43 build of LinqConnect. The new build can be downloaded from
http://www.devart.com/linqconnect/download.html
(the trial version) or from Registered Users' Area (for users with active subscription only).

For more information about the fixes and improvements available in LinqConnect 3.1.43, please refer to
http://www.devart.com/forums/viewtopic.php?t=23468

Post Reply