Skip to content

Latest commit

 

History

History
124 lines (92 loc) · 7.62 KB

Database-Table-Config-Xml.md

File metadata and controls

124 lines (92 loc) · 7.62 KB

'Table' object (entity-driven)

The Table object identifies an existing database Table (or View) and defines its code-generation characteristics.

The columns for the table (or view) are inferred from the database schema definition. The IncludeColumns and ExcludeColumns provide a shorthand to include or exclude selected columns from all the StoredProcedure children. A table can be defined more that once to enable different column configurations as required.

In addition to the primary Stored Procedures generation, the following types of artefacts can also be generated:


Property categories

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

Category Description
Key Provides the key configuration.
Columns Provides the Columns configuration.
CodeGen Provides the Code Generation configuration.
EntityFramework Provides the Entity Framework (EF) model configuration.
UDT Provides the User Defined Table and Table-Valued Parameter configuration.
Auth Provides the Authorization configuration.
Infer Provides the special Column Name inference configuration.
Collections Provides related child (hierarchical) configuration.

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


Key

Provides the key configuration.

Property Description
Name The name of the Table in the database. [Mandatory]
Schema The name of the Schema where the Table is defined in the database.
† Defaults to CodeGeneration.Schema.
Alias The Schema.Table alias name.
† Will automatically default where not specified.

Columns

Provides the Columns configuration.

Property Description
IncludeColumns The comma separated list of Column names to be included in the underlying generated output.
† Where not specified this indicates that all Columns are to be included.
ExcludeColumns The comma seperated list of Column names to be excluded from the underlying generated output.
† Where not specified this indicates no Columns are to be excluded.

CodeGen

Provides the Code Generation configuration. These primarily provide a shorthand to create the standard Get, GetAll, Create, Update, Upsert, Delete and Merge.

Property Description
Get Indicates whether a Get stored procedure is to be automatically generated where not otherwise explicitly specified.
GetAll Indicates whether a GetAll stored procedure is to be automatically generated where not otherwise explicitly specified.
† The GetAllOrderBy is used to specify the GetAll query sort order.
GetAllOrderBy The comma seperated list of Column names (including sort order ASC/DESC) to be used as the GetAll query sort order.
Create Indicates whether a Create stored procedure is to be automatically generated where not otherwise explicitly specified.
Update Indicates whether a Update stored procedure is to be automatically generated where not otherwise explicitly specified.
Upsert Indicates whether a Upsert stored procedure is to be automatically generated where not otherwise explicitly specified.
Delete Indicates whether a Delete stored procedure is to be automatically generated where not otherwise explicitly specified.
Merge Indicates whether a Merge (insert/update/delete of Udt list) stored procedure is to be automatically generated where not otherwise explicitly specified.
† This will also require a Udt (SQL User Defined Table) and Tvp (.NET Table-Valued Parameter) to function.

EntityFramework

Provides the Entity Framework (EF) model configuration.

Property Description
EfModel Indicates whether an Entity Framework .NET (C#) model is to be generated.
EfModelName The .NET (C#) EntityFramework (EF) model name.
† Defaults to Name.

UDT

Provides the User Defined Table and Table-Valued Parameter configuration.

Property Description
Udt Indicates whether a User Defined Table (UDT) type should be created.
UdtExcludeColumns The comma seperated list of Column names to be excluded from the User Defined Table (UDT).
† Where not specified this indicates that no Columns are to be excluded.
Tvp The name of the .NET entity associated with the Udt so that it can be expressed (created) as a Table-Valued Parameter for usage within the corresponding DbMapper.
EntityScope The entity scope option. Valid options are: Common, Business, Autonomous.
† Defaults to CodeGeneration.EntityScope. Determines where the entity is scoped/defined, being Common or Business (i.e. not externally visible).

Auth

Provides the Authorization configuration.

Property Description
Permission The permission (prefix) to be used for security permission checking (suffix defaults to Read, Write or Delete and can be overridden in the underlying stored procedure).
OrgUnitImmutable Indicates whether the OrgUnitId column is considered immutable, in that it can not be changed once set.
† Defaults to CodeGeneration.OrgUnitImmutable. This is only applicable for stored procedures.

Infer

Provides the special Column Name inference configuration.

Property Description
ColumnNameIsDeleted The column name for the IsDeleted capability.
† Defaults to CodeGeneration.IsDeleted.
ColumnNameTenantId The column name for the TenantId capability.
† Defaults to CodeGeneration.TenantId.
ColumnNameOrgUnitId The column name for the OrgUnitId capability.
† Defaults to CodeGeneration.OrgUnitId.
ColumnNameRowVersion The column name for the RowVersion capability.
† Defaults to CodeGeneration.RowVersion.
ColumnNameCreatedBy The column name for the CreatedBy capability.
† Defaults to CodeGeneration.CreatedBy.
ColumnNameCreatedDate The column name for the CreatedDate capability.
† Defaults to CodeGeneration.CreatedDate.
ColumnNameUpdatedBy The column name for the UpdatedBy capability.
† Defaults to CodeGeneration.UpdatedBy.
ColumnNameUpdatedDate The column name for the UpdatedDate capability.
† Defaults to CodeGeneration.UpdatedDate.
ColumnNameDeletedBy The column name for the DeletedBy capability.
† Defaults to CodeGeneration.UpdatedBy.
ColumnNameDeletedDate The column name for the DeletedDate capability.
† Defaults to CodeGeneration.UpdatedDate.

Collections

Provides related child (hierarchical) configuration.

Property Description
StoredProcedures The corresponding StoredProcedure collection.

A StoredProcedure object defines the stored procedure code-generation characteristics.