Skip to content

Latest commit

 

History

History
130 lines (97 loc) · 7.55 KB

Database-CodeGeneration-Config.md

File metadata and controls

130 lines (97 loc) · 7.55 KB

'CodeGeneration' object (database-driven)

The CodeGeneration object defines global properties that are used to drive the underlying database-driven code generation.


Property categories

The CodeGeneration object supports a number of properties that control the generated code output. These properties are separated into a series of logical categories.

Category Description
Infer Provides the special Column Name inference configuration.
Columns Provides the Columns configuration.
Path Provides the Path (Directory) configuration for the generated artefacts.
DotNet Provides the .NET configuration.
EntityFramework Provides the Entity Framework (EF) model configuration.
Outbox Provides the Event Outbox configuration.
Auth Provides the Authorization configuration.
Namespace Provides the .NET Namespace configuration for the generated artefacts.
Collections Provides related child (hierarchical) configuration.

The properties with a bold name are those that are more typically used (considered more important).


Infer

Provides the special Column Name inference configuration.

Property Description
columnNameIsDeleted The column name for the IsDeleted capability.
† Defaults to IsDeleted.
columnNameTenantId The column name for the TenantId capability.
† Defaults to TenantId.
columnNameOrgUnitId The column name for the OrgUnitId capability.
† Defaults to OrgUnitId.
columnNameRowVersion The column name for the RowVersion capability.
† Defaults to RowVersion.
columnNameCreatedBy The column name for the CreatedBy capability.
† Defaults to CreatedBy.
columnNameCreatedDate The column name for the CreatedDate capability.
† Defaults to CreatedDate.
columnNameUpdatedBy The column name for the UpdatedBy capability.
† Defaults to UpdatedBy.
columnNameUpdatedDate The column name for the UpdatedDate capability.
† Defaults to UpdatedDate.
columnNameDeletedBy The column name for the DeletedBy capability.
† Defaults to UpdatedBy.
columnNameDeletedDate The column name for the DeletedDate capability.
† Defaults to UpdatedDate.
orgUnitJoinSql The SQL table or function that is to be used to join against for security-based OrgUnitId verification.
† Defaults to [Sec].[fnGetUserOrgUnits]().
checkUserPermissionSql The SQL stored procedure that is to be used for Permission verification.
† Defaults to [Sec].[spCheckUserHasPermission].
getUserPermissionSql The SQL function that is to be used for Permission verification.
† Defaults to [Sec].[fnGetUserHasPermission].

Columns

Provides the Columns configuration.

Property Description
aliasColumns The list of Column and Alias pairs (split by a ^ lookup character) to enable column aliasing/renaming.
† Each alias value should be formatted as Column + ^ + Alias; e.g. PCODE^ProductCode.

Path

Provides the Path (Directory) configuration for the generated artefacts.

Property Description
pathBase The base path (directory) prefix for the Database-related artefacts; other Path* properties append to this value when they are not specifically overridden.
† Defaults to Company (runtime parameter) + . + AppName (runtime parameter). For example Beef.Demo.
pathDatabaseSchema The path (directory) for the Schema Database-related artefacts.
† Defaults to PathBase + .Database/Schema (literal). For example Beef.Demo.Database/Schema.
pathDatabaseMigrations The path (directory) for the Schema Database-related artefacts.
† Defaults to PathBase + .Database/Migrations (literal). For example Beef.Demo.Database/Migrations.
pathBusiness The path (directory) for the Business-related (.NET) artefacts.
† Defaults to PathBase + .Business (literal). For example Beef.Demo.Business.

DotNet

Provides the .NET configuration.

Property Description
autoDotNetRename The option to automatically rename the SQL Tables and Columns for use in .NET. Valid options are: None, PascalCase, SnakeKebabToPascalCase.
† Defaults SnakeKebabToPascalCase that will remove any underscores or hyphens separating each word and capitalize the first character of each; e.g. internal-customer_id would be renamed as InternalCustomerId. The PascalCase option will capatilize the first character only.
preprocessorDirectives Indicates whether to use preprocessor directives in the generated output.
collectionType The collection type. Valid options are: JSON, UDT.
† Values are JSON being a JSON array (preferred) or UDT for a User-Defined Type (legacy). Defaults to JSON.

EntityFramework

Provides the Entity Framework (EF) model configuration.

Property Description
efModel Indicates whether an Entity Framework .NET (C#) model is to be generated for all tables.
† This can be overridden within the Table(s).

Outbox

Provides the Event Outbox configuration.

Property Description
outbox Indicates whether to generate the event outbox SQL and .NET artefacts.
† Defaults to false.
outboxSchema The schema name of the event outbox table.
† Defaults to Outbox (literal).
outboxSchemaCreate Indicates whether to create the OutboxSchema within the database.
† Defaults to true.
outboxTable The name of the event outbox table.
† Defaults to EventOutbox (literal).
outboxEnqueueStoredProcedure The stored procedure name for the event outbox enqueue.
† Defaults to spEventOutboxEnqueue (literal).
outboxDequeueStoredProcedure The stored procedure name for the event outbox dequeue.
† Defaults to spEventOutboxDequeue (literal).

Auth

Provides the Authorization configuration.

Property Description
orgUnitImmutable Indicates whether the OrgUnitId column is considered immutable, in that it can not be changed once set.
† This is only applicable for stored procedures.

Namespace

Provides the .NET Namespace configuration for the generated artefacts.

Property Description
namespaceBase The base Namespace (root) for the .NET artefacts.
† Defaults to Company (runtime parameter) + . + AppName (runtime parameter). For example Beef.Demo.
namespaceCommon The Namespace (root) for the Common-related .NET artefacts.
† Defaults to NamespaceBase + .Common (literal). For example Beef.Demo.Common.
namespaceBusiness The Namespace (root) for the Business-related .NET artefacts.
† Defaults to NamespaceBase + .Business (literal). For example Beef.Demo.Business.
namespaceOutbox The Namespace (root) for the Outbox-related Publisher .NET artefacts.
† Defaults to NamespaceBusiness.

Collections

Provides related child (hierarchical) configuration.

Property Description
tables The corresponding Table collection.

A Table object provides the relationship to an existing table within the database.
queries The corresponding Query collection.

A Query object provides the primary configuration for a query, including multiple table joins.