Generating Source Code

One important aspect of working with the LLBLGen Pro designer is to generate source code from the models designed with the Designer. To do so press F7 or select Project -> Generate Source-code from the main menu. This will open the Code Generation Task Viewer which will guide you through the rest of the process.

Before code generation can take place, the Designer validates the project. If there are errors found during validation, no code can be generated. It doesn't matter whether the error is in the entity model and you want to generate code for a derived model or the error is in a derived model and you want to generate code for the entity model. To proceed in this situation, you first have to correct the error.

Generated VS.NET projects reference dependent generated VS.NET projects automatically

When code is generated and multiple vs.net projects are generated, it can be a generated vs.net project A is depending on another generated VS.NET project B. If they're generated in the same cycle, even if B already exists, the code generator will now reference B in A if A is newly generated using a VS.NET project reference. This makes it easier to get started with the generated code right away: e.g. generated Entity Framework models now properly have their persistence vs.net project reference the model vs.net project.

See for further information about how to generate code, the Code Generation Task Viewer section.

Automatic cleanup of outdated files

When generating code, especially when generating code automatically, it can be files are generated which over time aren't used anymore, e.g. an entity definition which has been removed, or renamed. To manually clean up these files is a tedious job so the designer can do this for you. This feature is controlled by a setting, Delete obsolete files, in the Project Settings -> Conventions -> General -> Code Generation. By default this setting is true.

If the 'Delete obsolete files' setting is set to true, the designer will for a specific output folder delete all files with the same extension as the ones currently being generated in that folder which were present when the code generation cycle was started and which weren't overwritten during a code generation task. If the setting is false, it will move the files which are considered obsolete to a folder called _OBSOLETE instead of deleting them.

Automatic code clean up is only performed when the code generation task generates multiple files, e.g. 'all entities' or 'all typed views'. This also means that it will only clean up obsolete files in folders which are targeted by these tasks. If you place your custom classes in a separate folder, they're left untouched, as they're not in the target folder of one of these tasks.

Example: you have a couple of partial classes defined for a few entities. If you place these partial classes in the 'Entities' folder, which also contains all generated entity classes, these partial classes you created will be seen as obsolete as they're not overwritten by the code generator. To avoid this, place your partial classes in a different folder inside the same csproj/vbproj, e.g. 'Extensions'. As 'Extensions' isn't a folder targeted by a code generation task it won't be part of the code clean up process and files in there are left as-is. Files with a different extension are also left alone. E.g. if you have a file called 'specifics.txt' in the Entities folder, it's not deleted as it has a different extension as the entity classes files and therefore isn't a left-over from code generation.