File match database.beef-5.yaml database.beef-5.yml database.beef-5.json *.database.beef-5.yaml *.database.beef-5.yml *.database.beef-5.json
Schema URL https://catalog.lintel.tools/schemas/schemastore/beef-database-v5-codegen/latest.json
Source https://raw.githubusercontent.com/Avanade/Beef/master/tools/Beef.CodeGen.Core/Schema/database.beef-5.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.

replace boolean

Defaults to true.

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].

aliasColumns string[]

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

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"
preprocessorDirectives boolean
collectionType string

Values are JSON being a JSON array (preferred) or UDT for a User-Defined Type (legacy). Defaults to JSON.

Values: "JSON" "UDT"
efModel boolean

This can be overridden within the Table(s).

outbox boolean

Defaults to false.

outboxSchema string

Defaults to Outbox (literal).

outboxSchemaCreate boolean

Defaults to true.

outboxTable string

Defaults to EventOutbox (literal).

outboxEnqueueStoredProcedure string

Defaults to spEventOutboxEnqueue (literal).

outboxDequeueStoredProcedure string

Defaults to spEventOutboxDequeue (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.

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.

namespaceOutbox string

Defaults to NamespaceBusiness.

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.

replace boolean

Defaults to CodeGeneration.Replace.

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.

jsonAliasColumns string[]

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

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

Defaults to CodeGeneration.EfModel.

efModelName string

Defaults to Name applying the CodeGeneration.AutoDotNetRename.

udt boolean
udtExcludeColumns string[]

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

tvp string
collectionType string

Values are JSON being a JSON array (preferred) or UDT for a User-Defined Type (legacy). Defaults to Config.CollectionType.

Values: "JSON" "UDT"
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[]
relationships Relationship[]
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.

replace boolean

Defaults to CodeGeneration.Replace.

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
collectionType string

Values are JSON being a JSON array (preferred) or UDT for a User-Defined Type (legacy). Defaults to Table.CollectionType.

Values: "JSON" "UDT"
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
collectionType string

Values are JSON being a JSON array (preferred) or UDT for a User-Defined Type (legacy). Defaults to StoredProcedure.CollectionType.

Values: "JSON" "UDT"
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"
Relationship object

The Relationship object enables the definition of an entity framework (EF) model relationship.

name string required
schema string

Defaults to CodeGeneration.Schema.

type string

Defaults to OneToMany.

Values: "OneToMany" "ManyToOne"
foreignKeyColumns string[]
principalKeyColumns string[]

Typically this is only used where referencing property(s) other than the primary key as the principal property(s).

onDelete string
Values: "NoAction" "Cascade" "ClientCascade" "ClientNoAction" "ClientSetNull" "Restrict" "SetNull"
autoInclude boolean

Defaults to false.

propertyName string

Defaults to Name using the CodeGeneration.AutoDotNetRename option.

efModelName string

Defaults to Name using the CodeGeneration.AutoDotNetRename option.

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.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.

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.

viewReplace boolean

Defaults to CodeGeneration.Replace.

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