Code Generation Addon

Main article about Addon Code generation is here

Description

Code Generation makes already pretty easy BGDatabase API even easier. If you use this addon- database will use generated classes instead of basic BGEntity while populating table rows. Each generated class defines additional properties to access the data.

Here is an example: lets assume you have a table named "MyTable" which has one single field: intField of type int.

To access it without CodeGen you would use something like this: var intValue = entity.Get<int>("intField");

As you can see, you should provide field name and field type.

With CodeGen you would use something like this var intValue = entity.intField;

So all fields with their types will be generated for you for maximum ease of use.

The only drawback CodeGen has- you need to regenerate the classes each time you change database structure (e.g. adding/removing tables or fields)

Parameter name Description
Code Generator Class to use for code generation. You can leave the default one, if you do not need any customization
Source file Source file to use for generated classes. All classes will be put into one single .cs file
Package Package for generated classes. For example (BansheeGz.BGDatabase.Example)
Class names prefix Prefix to use for each class. So if you use BGE_ prefix, the final class for "MyTable" table will be named BGE_MyTable
Field names prefix Prefix to use for each generated property. So if you use f_ prefix, the final class for "name" field will be named f_name