File match database.beef.yaml database.beef.yml database.beef.json
Schema URL https://catalog.lintel.tools/schemas/schemastore/beef-database-codegen/latest.json
Source https://raw.githubusercontent.com/Avanade/Beef/master/tools/Beef.CodeGen.Core/Schema/database.beef.json

Validate with Lintel

npx @lintel/lintel check

All of

Definitions

CodeGeneration object

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

schema string

This is used as the default 'Schema' for all child objects.

columnNameIsDeleted string

Defaults to 'IsDeleted'.

columnNameTenantId string

Defaults to 'TenantId'.

columnNameOrgUnitId string

Defaults to 'OrgUnitId'.

columnNameRowVersion string

Defaults to 'RowVersion'.

columnNameCreatedBy string

Defaults to 'CreatedBy'.

columnNameCreatedDate string

Defaults to 'CreatedDate'.

columnNameUpdatedBy string

Defaults to 'UpdatedBy'.

columnNameUpdatedDate string

Defaults to 'UpdatedDate'.

columnNameDeletedBy string

Defaults to 'UpdatedBy'.

columnNameDeletedDate string

Defaults to 'UpdatedDate'.

orgUnitJoinSql string

Defaults to '[Sec].fnGetUserOrgUnits'.

checkUserPermissionSql string

Defaults to '[Sec].[spCheckUserHasPermission]'.

getUserPermissionSql string

Defaults to '[Sec].[fnGetUserHasPermission]'.

cdcSchema string

Defaults to 'XCdc' (literal).

cdcAuditTableName string

Defaults to 'CdcTracking' (literal).

cdcIdentifierMapping boolean
cdcIdentifierMappingTableName string

Defaults to 'CdcIdentifierMapping' (literal).

cdcIdentifierMappingStoredProcedureName string

Defaults to 'spCreateCdcIdentifierMapping' (literal).

cdcExcludeColumnsFromETag string[]
jsonSerializer string

Defaults to 'Newtonsoft'. This can be overridden within the 'Entity'(s).

Values: "None" "Newtonsoft"
pluralizeCollectionProperties boolean
hasBeefDbo boolean

Defaults to 'true'.

autoDotNetRename string

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.

Values: "None" "PascalCase" "SnakeKebabToPascalCase"
entityScope string

Defaults to 'Common' for backwards compatibility; 'Autonomous' is recommended. Determines where the entity is scoped/defined, being 'Common' or 'Business' (i.e. not externally visible).

Values: "Common" "Business" "Autonomous"
eventSubjectRoot string

Used to enable the sending of messages to the likes of EventHub, Service Broker, SignalR, etc. This can be extended within the 'Entity'(s).

eventSubjectFormat string

Defaults to 'NameAndKey' (being the event subject name appended with the corresponding unique key.)'.

Values: "NameOnly" "NameAndKey"
eventActionFormat string

Defaults to 'None' (no formatting required, i.e. as-is).

Values: "None" "PastTense"
eventSourceRoot string

The event source is only updated where an 'EventSourceKind' is not 'None'. This can be extended within the 'Entity'(s).

eventSourceKind string

Defaults to 'None' (being the event source is not updated).

Values: "None" "Absolute" "Relative" "RelativeOrAbsolute"
eventSourceFormat string

Defaults to 'NameAndKey' (being the event subject name appended with the corresponding unique key.)'.

Values: "NameOnly" "NameAndKey" "NameAndGlobalId"
eventOutbox boolean
eventOutboxTableName string

Defaults to 'EventOutbox' (literal).

pathBase string

Defaults to 'Company' (runtime parameter) + '.' + 'AppName' (runtime parameter). For example 'Beef.Demo'.

pathDatabaseSchema string

Defaults to 'PathBase' + '.Database/Schema' (literal). For example 'Beef.Demo.Database/Schema'.

pathDatabaseMigrations string

Defaults to 'PathBase' + '.Database/Migrations' (literal). For example 'Beef.Demo.Database/Migrations'.

pathBusiness string

Defaults to 'PathBase' + '.Business' (literal). For example 'Beef.Demo.Business'.

PathCdcPublisher string

Defaults to 'PathBase' + '.Cdc' (literal). For example 'Beef.Demo.Cdc'.

orgUnitImmutable boolean

This is only applicable for stored procedures.

namespaceBase string

Defaults to 'Company' (runtime parameter) + '.' + 'AppName' (runtime parameter). For example 'Beef.Demo'.

namespaceCommon string

Defaults to 'NamespaceBase' + '.Common' (literal). For example 'Beef.Demo.Common'.

namespaceBusiness string

Defaults to 'NamespaceBase' + '.Business' (literal). For example 'Beef.Demo.Business'.

NamespaceCdcPublisher string

Defaults to 'NamespaceBase' + '.CdcPublisher' (literal). For example 'Beef.Demo.CdcPublisher'.

tables Table[]
queries Query[]
Table object

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

name string required
schema string

Defaults to 'CodeGeneration.Schema'.

alias string

Will automatically default where not specified.

includeColumns string[]

Where not specified this indicates that all 'Columns' are to be included.

excludeColumns string[]

Where not specified this indicates no 'Columns' are to be excluded.

get boolean
getAll boolean

The 'GetAllOrderBy' is used to specify the 'GetAll' query sort order.

getAllOrderBy string[]

This relates to the 'GetAll' selection.

create boolean
update boolean
upsert boolean
delete boolean
merge boolean

This will also require a 'Udt' (SQL User Defined Table) and 'Tvp' (.NET Table-Valued Parameter) to function.

efModel boolean
efModelName string

Defaults to 'Name'.

udt boolean
udtExcludeColumns string[]

Where not specified this indicates that no 'Columns' are to be excluded.

tvp string
entityScope string

Defaults to 'CodeGeneration.EntityScope'. Determines where the entity is scoped/defined, being 'Common' or 'Business' (i.e. not externally visible).

Values: "Common" "Business" "Autonomous"
permission string
orgUnitImmutable boolean

Defaults to 'CodeGeneration.OrgUnitImmutable'. This is only applicable for stored procedures.

columnNameIsDeleted string

Defaults to 'CodeGeneration.IsDeleted'.

columnNameTenantId string

Defaults to 'CodeGeneration.TenantId'.

columnNameOrgUnitId string

Defaults to 'CodeGeneration.OrgUnitId'.

columnNameRowVersion string

Defaults to 'CodeGeneration.RowVersion'.

columnNameCreatedBy string

Defaults to 'CodeGeneration.CreatedBy'.

columnNameCreatedDate string

Defaults to 'CodeGeneration.CreatedDate'.

columnNameUpdatedBy string

Defaults to 'CodeGeneration.UpdatedBy'.

columnNameUpdatedDate string

Defaults to 'CodeGeneration.UpdatedDate'.

columnNameDeletedBy string

Defaults to 'CodeGeneration.UpdatedBy'.

columnNameDeletedDate string

Defaults to 'CodeGeneration.UpdatedDate'.

storedProcedures StoredProcedure[]
StoredProcedure object

The code generation for an 'StoredProcedure' is primarily driven by the 'Type' property. This encourages (enforces) a consistent implementation for the standardised CRUD (Create, Read, Update and Delete) actions, as well as supporting 'Upsert', 'Merge' and ad-hoc queries as required.

name string required

See 'StoredProcedureName' for the actual name used in the database.

type string

Defaults to 'GetColl'.

Values: "Get" "GetColl" "Create" "Update" "Upsert" "Delete" "Merge"
paging boolean

This only applies where the stored procedure operation 'Type' is 'GetColl'.

storedProcedureName string

Defaults to 'sp' + 'Table.Name' + 'Name'; e.g. 'spTableName' or 'spPersonGet'.

reselectStatement string

Defaults to '[{{Table.Schema}}].[sp{{Table.Name}}Get]' passing the primary key column(s).

intoTempTable boolean

A 'Select * from #TempTable' is also performed (code-generated) where the stored procedure operation 'Type' is 'GetColl'.

withHints string
mergeOverrideIdentityColumns string[]

This is used to override the default behaviour of using the primary key column(s).

permission string
orgUnitImmutable boolean

Defaults to 'Table.OrgUnitImmutable'.

includeColumns string[]

Where not specified this indicates that all 'Columns' are to be included. Only filters the columns where 'Type' is 'Get', 'GetColl', 'Create', 'Update' or 'Upsert'.

excludeColumns string[]

Where not specified this indicates no 'Columns' are to be excluded. Only filters the columns where 'Type' is 'Get', 'GetColl', 'Create', 'Update' or 'Upsert'.

parameters Parameter[]
where Where[]
orderby OrderBy[]
execute Execute[]
Parameter object

The 'Parameter' is used to define a stored procedure parameter and its charateristics. These are in addition to those that are automatically inferred (added) by the selected 'StoredProcedure.Type'.

name string required
column string

Defaults to 'Name'.

sqlType string
nullable boolean

Note that when the parameter value is 'NULL' it will not be included in the query.

treatColumnNullAs boolean
collection boolean
operator string

Defaults to 'EQ'.

Values: "EQ" "NE" "LT" "LE" "GT" "GE" "LIKE"
Where object

The 'Where' object defines an additional where 'Statement' to be added. This is in addition to those automatically added based on the 'StoredProcedure.Type'.

statement string required
OrderBy object

The 'OrderBy' object defines the query order. Only valid for 'StoredProcedure.Type' of 'GetAll'.

name string required
order string

Defaults to 'Ascending'.

Values: "Ascending" "Descending"
Execute object

The Execute object enables additional TSQL statements to be embedded within the stored procedure.

statement string required
location string

Defaults to 'After'.

Values: "Before" "After"
Query object

The 'Query' object enables the definition of more complex multi-table queries ('Joins') that would primarily result in a database View. The primary table 'Name' for the query is required to be specified. Multiple queries can be specified for the same table(s). The 'IncludeColumns' and 'ExcludeColumns' provide a shorthand to include or exclude selected columns; with the 'AliasColumns' providing a means to rename where required (for example duplicate name). Additional 'Where' and 'Order' configuration can also be added as required.

name string required
schema string

Defaults to 'CodeGeneration.dbo'.

alias string

Will automatically default where not specified.

includeColumns string[]

Where not specified this indicates that all 'Columns' are to be included.

excludeColumns string[]

Where not specified this indicates no 'Columns' are to be excluded.

aliasColumns string[]

Each alias value should be formatted as 'Column' + '^' + 'Alias'; e.g. 'PCODE^ProductCode'

view boolean
viewName string

Defaults to 'vw' + 'Name'; e.g. 'vwTableName'.

viewSchema string

Defaults to 'Schema'.

permission string

The suffix is optional, and where not specified will default to '.READ'.

columnNameIsDeleted string

Defaults to 'CodeGeneration.IsDeleted'.

columnNameTenantId string

Defaults to 'CodeGeneration.TenantId'.

columnNameOrgUnitId string

Defaults to 'CodeGeneration.OrgUnitId'.

columnNameRowVersion string

Defaults to 'CodeGeneration.RowVersion'.

columnNameCreatedBy string

Defaults to 'CodeGeneration.CreatedBy'.

columnNameCreatedDate string

Defaults to 'CodeGeneration.CreatedDate'.

columnNameUpdatedBy string

Defaults to 'CodeGeneration.UpdatedBy'.

columnNameUpdatedDate string

Defaults to 'CodeGeneration.UpdatedDate'.

columnNameDeletedBy string

Defaults to 'CodeGeneration.UpdatedBy'.

columnNameDeletedDate string

Defaults to 'CodeGeneration.UpdatedDate'.

joins QueryJoin[]
order QueryOrder[]
where QueryWhere[]
QueryJoin object

The 'QueryJoin' object defines a join to another (or same) table within a query. The 'Type' defines the join type, such as inner join, etc. The 'IncludeColumns' and 'ExcludeColumns' provide a shorthand to include or exclude selected columns; with the 'AliasColumns' providing a means to rename where required (for example duplicate name).

name string required
schema string

Defaults to 'Table.Schema'; i.e. same schema.

alias string

Will automatically default where not specified.

type string

Defaults to 'Inner'.

Values: "Inner" "Left" "Right" "Full"
includeColumns string[]

Where not specified this indicates that all 'Columns' are to be included.

excludeColumns string[]

Where not specified this indicates no 'Columns' are to be excluded.

aliasColumns string[]

Each alias value should be formatted as 'Column' + '^' + 'Alias'; e.g. 'PCODE^ProductCode'

columnNameIsDeleted string

Defaults to 'CodeGeneration.IsDeleted'.

columnNameTenantId string

Defaults to 'CodeGeneration.TenantId'.

columnNameOrgUnitId string

Defaults to 'CodeGeneration.OrgUnitId'.

columnNameRowVersion string

Defaults to 'CodeGeneration.RowVersion'.

columnNameCreatedBy string

Defaults to 'CodeGeneration.CreatedBy'.

columnNameCreatedDate string

Defaults to 'CodeGeneration.CreatedDate'.

columnNameUpdatedBy string

Defaults to 'CodeGeneration.UpdatedBy'.

columnNameUpdatedDate string

Defaults to 'CodeGeneration.UpdatedDate'.

columnNameDeletedBy string

Defaults to 'CodeGeneration.UpdatedBy'.

columnNameDeletedDate string

Defaults to 'CodeGeneration.UpdatedDate'.

QueryJoinOn object

The 'QueryJoinOn' object defines the join on characteristics for a join within a query.

name string required
toSchema string

Defaults to 'Table.Schema'; i.e. same schema. See also 'ToTable' and 'ToColumn' as these all relate.

toTable string

Defaults to 'Table.Name'; i.e. primary table. See also 'ToSchema' and 'ToColumn' as these all relate.

toColumn string

Defaults to 'Name'; i.e. assumes same name. See also 'ToSchema' and 'ToTable' as these all relate.

toStatement string
QueryOrder object

The 'QueryOrder' object that defines the query order.

name string required

See also 'Schema' and 'Table' as these all relate.

schema string

Defaults to 'Query.Schema'.

table string

Defaults to 'Table.Name'; i.e. primary table. See also 'Schema' and 'Column' as these all relate.

order string

Defaults to 'Ascending'.

Values: "Ascending" "Descending"
QueryWhere object

The 'QueryWhere' object defines an additional where 'Statement' to be added.

statement string required