mihies wrote:
Hi Frans,
Do you consider in making generated code less verbose, or at least have an option to reduce verbosisty?
Here are few ideas:
- remove postfix Entity (CustomerEntity -> Customer)
- move Fields from [Name]Fields -> [Name] (i.e. CustomerEntity.Id instead of CustomerFields.Id) -> (Customer.Id)
- drop Entity from Relation names (i.e. OrderEntityUsingOrderId -> OrderUsingOrderId)
Code would be cleaner and it would still be readable (in the context of the use). I am sure there are other possibilites to code bloating..
About Entity postfix: we tried to remove that from the code in v2.0, but it's not that easy. The thing is that it will lead to more compilation problems, as the risk of having a name clash with a type in the .NET framework is much higher. It's also a lot of work and it has to be optional as otherwise it will break code all over the place. So not a feature worth spending a lot of time on if there are other features waiting, IMHO
About the 'Fields' in CustomerFields: that's on purpose, as it's not possible to have a static property and a non-static property with the same name. (CustomerEntity.ID would imply that.). Sure, say we do add the option of dropping 'Entity' from the entity names, optionally, then it would be possible, though this would cause headaches in support, as the user then has to specify that the 'Entity' name was dropped, and that CustomerFields suddenly is called CustomerEntity. I don't think that's really that helpful. As code is out there already with these name elements, removing them isn't an option.
About removing 'Entity' from Relation names: It was added since the beginning, to be consistent. removing it should be optional as loads of code is already using the 'Entity' scheme.
With generated code, there's a problem: the names cooked up by the generator have to be unique, and also make sense. Sure, some people don't like 'Entity' but I don't consider it a big issue to spend a lot of time on, as it WILL need a lot of time, documentation and is likely to cause more problems than it would solve, as there's currently no problem with the name, other than 'it might not look great', however incompilable code, code differences between code generated on one machine versus code generated on another is IMHO a problem, which can occur with these optional features, and won't exist otherwise.