ECO: Code generation in BDS 2006 and Delphi .NET
Firstly, deactivate the option "One file per class" for the code generation in Delphi (see screenshot) in case you enabled it. It is set to "off" by default when you install BDS.
You get to this dialog using "Tools / Options...". There are two issues if you leave it checked:
- uses-clause: The uses clause is not being generated correctly if you e.g. have a method that returns another class which resides in another unit. You will have to add the references yourself.
- duplicate names: if an association(-end) has the same name as a class you get type-conflicts and will have to use the full name and thus edit the code manually
Finally - and this is the most annoying - Uml-tags will be generated everytime you invoke the code generator and thus the code becomes incompilable as well.
I wrote a simple command-line tool, which automatically makes the necessary changes for the last two cases. The uses-clause and duplicate-names issue can be neglected as you can set the options to circumvent it.
Be aware that this tools comes without any guarantee or liability. Use it at your own risk.
You can download it from CodeCentral.
0 Comments:
Post a Comment
<< Home