Description
There is an easy way to add your own C# fields, properties and methods to the classes, generated by CodeGen addon or any other code generator. This can be very useful in many cases.
How to add
You can not add your own code to the C# source file, which was used in CodeGen addon settings, because this file is rewritten every time the code is generated. So the solution is to create your own C# source file (the name does not matter, but do not give it a name of existing classes) and add the partial class with the same name/namespace as the generated one to this new C# source file. You can add as many classes as you want to this C# source file.
Example
Let's say we have a list of Items with quantity and price,
and now we want to have a sum readonly property equals to quantity multiplied by price.
If you need to see the sum value under database GUI, you can create sum calculated or programmable field
however, if it's not a requirement, instead of creating sum field,
you can simply add C# new property manually to generated class for Items table.
Here is the CodeGen addon settings
We add GenExtension.cs file manually and add D_Items partial class to it and then add new sum property to it
Now we can use this new property just like any other properties.
The same technique can be used to add any number of custom C# fields/properties/methods to generated classes, which can be very useful in many cases. If you are looking for other example, download our inventory project, which uses this technique