Table of Contents

Generated Artifacts

Generated artifacts are the C# files written by the Registration Builder.

They are the output of automatic declaration.

They are compiled with the application and register schema versions, modules, forms, lookups, locators, select definitions, table descriptors and code providers.

Artifact Set

For a schema version N, the console tool generates:

  • SchemaVersionN.cs
  • RegistryVersionN.cs
  • RegistryVersionN.Modules.cs
  • RegistryVersionN.Forms.cs
  • RegistryVersionN.Lookups.cs
  • RegistryVersionN.Locators.cs
  • RegistryVersionN.CodeProviders.cs

TinyERP version 2 generates:

  • SchemaVersion2.cs
  • RegistryVersion2.cs
  • RegistryVersion2.Modules.cs
  • RegistryVersion2.Forms.cs
  • RegistryVersion2.Lookups.cs
  • RegistryVersion2.Locators.cs
  • RegistryVersion2.CodeProviders.cs

Generated Header

Generated files contain an auto-generated header.

<auto-generated>
This file was generated by Tripous RegBuilder.
Do not edit this file manually.
</auto-generated>

This header is the rule.

Do not manually edit generated artifacts.

Change the schema metadata and run the builder again.

Schema Version File

SchemaVersionN.cs registers database schema for a version.

It contains:

  • generated CREATE TABLE statements
  • provider-neutral SQL tokens
  • table registration calls
  • code provider seed statements
  • statements that should run after table creation

This file is used by schema execution.

It describes database structure, not application behavior.

Registry Version File

RegistryVersionN.cs declares the registry version class.

It usually contains the constructor and VersionNumber.

Example:

public partial class RegistryVersion2: RegistryVersion
{
    public override int VersionNumber { get; } = 2;
}

The detailed registration work is split into partial files.

Modules File

RegistryVersionN.Modules.cs registers modules and their table descriptors.

It contains generated code for:

  • ModuleDef
  • TableDef
  • list SelectDef
  • joins
  • fields
  • field flags
  • filters
  • detail table structure

This is usually the largest generated file.

Forms File

RegistryVersionN.Forms.cs registers forms in DesktopRegistry.

It maps modules to form names, form classes, groups and item page classes.

Generated forms are declarations.

Custom form behavior belongs in handwritten form classes.

Lookups File

RegistryVersionN.Lookups.cs registers lookup sources.

It can generate:

  • table-backed lookups
  • enum-backed lookup sources
  • class-backed lookup sources

Lookup metadata comes from table headers and field comments.

Locators File

RegistryVersionN.Locators.cs registers locator definitions.

Locators are used for searchable reference selection.

The generated locator registration is the base declaration.

Custom locator fields, search SQL or behavior may still be extended in handwritten code.

Code Providers File

RegistryVersionN.CodeProviders.cs registers code provider names.

Code providers are discovered from:

  • field -- Code metadata
  • header Code: metadata

Draft code providers generate both draft and normal provider names.

Handwritten Registry Files

Generated registry files may live next to handwritten registry files.

TinyERP has handwritten files such as:

  • Registry.cs
  • Registry.Miscs.cs
  • Registry.DocumentHandlers.cs

These files coordinate registration and add application-specific behavior.

They are not generated artifacts.

They are valid extension points.

Registration Order

Application startup usually registers schema versions first and descriptors after that.

TinyERP coordinates this in Registry.cs.

Schema registration calls each schema version.

Descriptor registration calls each registry version in order:

  • lookups
  • lookup sources
  • locators
  • code providers
  • modules
  • forms

After generated descriptors are registered, handwritten update methods may adjust or extend them.

Practical Rule

Generated artifacts are committed source files, but they are generated output.

Use them for inspection and review.

Do not use them as the place for manual application logic.