Page 1 of 1

Code Generation does generate wrong method names

Posted: Mon 09 Nov 2009 13:09
by marcelser
Hi,

We created tables using the "create from database" wizard and I choosed "Unchanged" for alle the capitalize/singularize/pluralize options and the generated Classes, Properties and Entity Set names look ok.

For example there's a Class named "SyncRev" and the Entity Set is also "SyneRev".

But when I generate the code I get a "SyncRevs" Method for this table name instead of "SyncRev" (the Entity Set name). For us it is very disturbing that the code generator does pluralize the generated method names. When the setting in the project is "unchanged" the code generator should also stick to this setting and just use the "Entity Set" name given because most of our tables have generated names and it breaks the mapping between our table names and the generated method names if some of the them get pluralized. For example "Cstmrs" is not pluralized but "CwCTTentX" gets a method name "CwCTTEntXes".

We must get rid of the additional "s" or "es", how can we do this and why does the code generator ignore the "Entity Set" Name when generating classes?

Thanks for any help.

Posted: Tue 10 Nov 2009 11:49
by Shalex
Thank you for the bug report. The fix will be available in the next build.
It seems that you are using LINQ to SQL and, probably, the latest beta version of Entity Developer. In this case, you can fix the problem yourself now. The language of your code generation is not clear from your post, but we assume that it is C#.
Assuming the above: create a new template in Template Browser, set its name, select the LINQ to SQL type, make Load from existing template (with the LINQ C# option). Navigate in the template text to the GenerateContextObjectServices() method generation, and replace the following line in the template:

Code: Select all

         Devart.Data.Linq.Table> 
with the following code:

Code: Select all

         Devart.Data.Linq.Table> 
Save the new template. Then open your LINQ to SQL model in Entity Developer, Project -> Properties, and select your new template in the Templates drop-down list of the opened dialog. And now your template will be used for the code generation for your model.