Page 1 of 1

Bug when generating code for the default value of an Enum

Posted: Thu 29 Dec 2011 13:02
by crazypit
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.

Posted: Fri 30 Dec 2011 18:15
by StanislavK
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)?

Posted: Mon 02 Jan 2012 07:56
by crazypit
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.

Posted: Mon 02 Jan 2012 08:22
by crazypit
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.

Posted: Mon 09 Jan 2012 15:47
by StanislavK
Sorry for the delay. We have reproduced the issue, and will post here when it is fixed.

Posted: Tue 28 Feb 2012 16:22
by StanislavK
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