File match entity.beef.yaml entity.beef.yml entity.beef.json refdata.beef.yaml refdata.beef.yml refdata.beef.json datamodel.beef.yaml datamodel.beef.yml datamodel.beef.json
Schema URL https://catalog.lintel.tools/schemas/schemastore/beef-entity-codegen/latest.json
Source https://raw.githubusercontent.com/Avanade/Beef/master/tools/Beef.CodeGen.Core/Schema/entity.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 entity-driven code generation.

refDataNamespace string

Defaults to 'Company' + '.' (literal) + AppName + '.' (literal) + 'EntityUsing' + '.Entities' (literal).

refDataCommonNamespace string

Defaults to 'Company' + '.' (literal) + AppName + '.Common.Entities' (literal).

refDataText boolean

This is used where serializing within the Web API 'Controller' and the 'ExecutionContext.IsRefDataTextSerializationEnabled' is set to 'true' (which is automatically set where the url contains '$text=true').

refDataWebApiRoute string
refDataCache string

Defaults to 'ReferenceDataCache'. A value of 'ReferenceDataCache' specifies a single-tenant cache; otherwise, 'ReferenceDataMultiTenantCache' for a multi-tenant cache leverageing the 'ExecutionContext.TenantId'.

Values: "ReferenceDataCache" "ReferenceDataMultiTenantCache"
refDataAppendToNamespace string

Defaults to 'null'; being nothing to append.

refDataBusNamespace string
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). Additionally, there is the special case of 'Autonomous' where both a 'Common' and 'Business' entity are generated (where only the latter inherits from 'EntityBase', etc).

Values: "Common" "Business" "Autonomous"
entityUsing string

Defaults to 'Common' (unless 'EntityScope' is 'Autonomous' and then it will default to 'Business') which will add '.Common.Entities'. Additionally, 'Business' to add '.Business.Entities', 'All' to add both, and 'None' to exclude any. This can be overridden for each 'Entity'.

Values: "Common" "Business" "All" "None"
jsonSerializer string

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

Values: "None" "Newtonsoft"
etagJsonName string

Defaults to 'etag'. Note that the 'JsonName' can be set individually per property where required.

Values: "etag" "eTag" "_etag" "_eTag" "ETag" "ETAG"
usingNamespace1 string

Typically used where referening a 'Type' from a Namespace that is not generated by default.

usingNamespace2 string

Typically used where referening a 'Type' from a Namespace that is not generated by default.

usingNamespace3 string

Typically used where referening a 'Type' from a Namespace that is not generated by default.

webApiAuthorize string

This can be overridden within the 'Entity'(s) and/or their corresponding 'Operation'(s).

appBasedAgentArgs boolean
webApiAutoLocation boolean

This will automatically set the 'Operation.WebApiLocation' for an 'Operation' named 'Create' where there is a corresponding named 'Get'. This can be overridden within the 'Entity'(s).

webApiRoutePrefix string

This is the base (prefix) 'URI' prepended to all entity and underlying 'Operation'(s).

validatorLayer string

Defaults to 'Business'. A value of 'Business' indicates that the Validators will be defined within the 'Business' namespace/assembly; otherwise, defined within the 'Common' namespace/assembly.

Values: "Business" "Common"
databaseName string

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

databaseSchema string

Defaults to 'dbo'.

entityFrameworkName string

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

cosmosName string

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

odataName string

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

httpAgentName string

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

refDataDefaultMapperConverter string

Defaults to 'ReferenceDataCodeConverter'. Where this value is suffixed by '' or '{T}' this will automatically set 'Property.DataConverterIsGeneric' to 'true'.

Values: "ReferenceDataCodeConverter" "ReferenceDataCodeConverter{T}" "ReferenceDataCodeConverter<T>" "ReferenceDataInt32IdConverter" "ReferenceDataInt32IdConverter{T}" "ReferenceDataInt32IdConverter<T>" "ReferenceDataNullableInt32IdConverter" "ReferenceDataNullableInt32IdConverter{T}" "ReferenceDataNullableInt32IdConverter<T>" "ReferenceDataInt64IdConverter" "ReferenceDataInt64IdConverter{T}" "ReferenceDataInt64IdConverter<T>" "ReferenceDataNullableInt64IdConverter" "ReferenceDataNullableInt64IdConverter{T}" "ReferenceDataNullableInt64IdConverter<T>" "ReferenceDataGuidIdConverter" "ReferenceDataGuidIdConverter{T}" "ReferenceDataGuidIdConverter<T>" "ReferenceDataNullableGuidIdConverter" "ReferenceDataNullableGuidIdConverter{T}" "ReferenceDataNullableGuidIdConverter<T>"
dataUsingNamespace string
databaseUsingNamespace string
entityFrameworkUsingNamespace string
cosmosUsingNamespace string
odataUsingNamespace string
eventPublish string

Defaults to 'DataSvc'; unless the 'EventOutbox' is not 'None' where it will default to 'Data'. Used to enable the sending of messages to the likes of EventHub, Service Broker, SignalR, etc. This can be overridden within the 'Entity'(s).

Values: "None" "DataSvc" "Data"
eventOutbox string

Defaults to 'None'. A value of 'Database' will result in the 'DatabaseEventOutboxInvoker' being used to orchestrate.

Values: "None" "Database"
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"
eventSubjectRoot string

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

eventSubjectFormat string

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

Values: "NameOnly" "NameAndKey"
eventSubjectSeparator string

Defaults to '.'. Used only where the subject is automatically inferred.

eventActionFormat string

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

Values: "None" "PastTense"
eventCasing string

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

Values: "None" "Lower" "Upper"
eventTransaction boolean

Usage will force a rollback of any underlying data transaction (where the provider supports TransactionScope) on failure, such as an 'EventPublish' error. This is by no means implying a Distributed Transaction (DTC) should be invoked; this is only intended for a single data source that supports a TransactionScope to guarantee reliable event publishing. Defaults to 'false'. This essentially defaults the 'Entity.EventTransaction' where not otherwise specified. This should only be used where 'EventPublish' is 'DataSvc' and a transactionally-aware data source is being used.

grpc boolean

gRPC support is an explicit opt-in model. Must be set to 'true' for any of the subordinate gRPC capabilities to be code-generated. Will require each 'Entity', and corresponding 'Property' and 'Operation' to be opted-in specifically.

pathBase string

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

pathCommon string

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

pathBusiness string

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

pathApi string

Defaults to 'PathBase' + '.' + 'ApiName' (runtime parameter). For example 'Beef.Demo.Api'.

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

namespaceApi string

Defaults to 'NamespaceBase' + '.' + 'ApiName' (runtime parameter). For example 'Beef.Demo.Api'.

entities Entity[]
Entity object

The 'Entity' is used as the primary configuration for driving the entity-driven code generation.

name string required
text string

Overrides the Name (as sentence text) for the summary comments. It will be formatted as: 'Represents the {Text} entity.'. To create a '' within use moustache shorthand (e.g. {{Xxx}}).

fileName string

Overrides the Name as the code-generated file name.

entityScope string

Defaults to the 'CodeGeneration.EntityScope'. Determines where the entity is scoped/defined, being 'Common' or 'Business' (i.e. not externally visible). Additionally, there is a special case of 'Autonomous' where both a 'Common' and 'Business' entity are generated (where only the latter inherits from 'EntityBase', etc).

Values: "Common" "Business" "Autonomous"
entityUsing string

Defaults to 'EntityScope' ('Autonomous' will result in 'Business'). A value of 'Common' will add '.Common.Entities', 'Business' will add '.Business.Entities', 'All' to add both, and 'None' to exclude any.

Values: "Common" "Business" "All" "None"
privateName string

Overrides the 'Name' to be used for private fields. By default reformatted from 'Name'; e.g. 'FirstName' as '_firstName'.

argumentName string

Overrides the 'Name' to be used for argument parameters. By default reformatted from 'Name'; e.g. 'FirstName' as 'firstName'.

constType string

The .NET Type to be used for the 'const' values. Defaults to 'string'.

Values: "int" "long" "Guid" "string"
isInitialOverride boolean

Set to either 'true' or 'false' to override as specified; otherwise, 'null' to check each property. Defaults to 'null'.

refDataType string

Required to identify an entity as being Reference Data. Specifies the underlying .NET Type used for the Reference Data identifier.

Values: "int" "long" "Guid" "string"
refDataText boolean

This is used where serializing within the Web API'Controller' and the 'ExecutionContext.IsRefDataTextSerializationEnabled' is set to 'true' (which is automatically set where the url contains '$text=true').

refDataSortOrder string

Specifies the default sort order for the underlying Reference Data collection. Defaults to 'SortOrder'.

Values: "SortOrder" "Id" "Code" "Text"
refDataStringFormat string

The string format supports the standard composite formatting; where the following indexes are used: '{0}' for 'Id', '{1}' for 'Code' and '{2}' for 'Text'. Defaults to '{2}'.

inherits string

Defaults to 'EntityBase' for a standard entity. For Reference Data it will default to 'ReferenceDataBaseXxx' depending on the corresponding 'RefDataType' value. See 'OmitEntityBase' if the desired outcome is to not inherit from any of the aforementioned base classes.

implements string
implementsAutoInfer boolean

Will attempt to infer the following: 'IGuidIdentifier', 'IInt32Identifier', 'IInt64Identifier', 'IStringIdentifier', 'IETag' and 'IChangeLog'. Defaults to 'true'.

abstract boolean
genericWithT boolean
namespace string

Appended to the end of the standard structure as follows: '{Company}.{AppName}.Common.Entities.{Namespace}'.

omitEntityBase boolean

As such any of the 'EntityBase' related capabilites are not supported (are omitted from generation). The intention for this is more for the generation of simple internal entities.

jsonSerializer string

Defaults to the 'CodeGeneration.JsonSerializer' configuration property where specified; otherwise, 'Newtonsoft'.

Values: "None" "Newtonsoft"
collection boolean
collectionResult boolean

Enables the likes of additional paging state to be stored with the underlying collection.

collectionKeyed boolean
collectionInherits string

Defaults to 'EntityBaseCollection' or 'EntityBaseKeyedCollection' depending on 'CollectionKeyed'. For Reference Data it will default to 'ReferenceDataCollectionBase'.

collectionResultInherits string

Defaults to 'EntityCollectionResult'.

get boolean
getAll boolean
create boolean
update boolean
patch boolean
delete boolean
autoImplement string

Defaults to 'None'. Indicates that the implementation for the underlying 'Operations' will be auto-implemented using the selected data source (unless explicity overridden). When selected some of the related attributes will also be required (as documented). Additionally, the 'AutoImplement' indicator must be selected for each underlying 'Operation' that is to be auto-implemented.

Values: "Database" "EntityFramework" "Cosmos" "OData" "HttpAgent" "None"
dataCtor string

Defaults to 'Public'.

Values: "Public" "Private" "Protected"
dataCtorParams string[]

Each constructor parameter should be formatted as 'Type' + '^' + 'Name'; e.g. 'IConfiguration^Config'. Where the 'Name' portion is not specified it will be inferred. Where the 'Type' matches an already inferred value it will be ignored.

dataExtensions boolean

This can be overridden using 'Operation.DataExtensions'.

databaseName string

Defaults to the 'CodeGeneration.DatabaseName' configuration property (its default value is 'IDatabase').

databaseSchema string

Defaults to 'dbo'.

databaseMapperInheritsFrom string
databaseCustomerMapper boolean

Otherwise, by default, a 'Mapper' will be generated.

entityFrameworkName string

Defaults to the 'CodeGeneration.EntityFrameworkName' configuration property (its default value is 'IEfDb').

entityFrameworkModel string
entityFrameworkMapperInheritsFrom string

Defaults to 'Model.{Name}'; i.e. an entity with the same name in the 'Model' namespace.

entityFrameworkCustomMapper boolean

Otherwise, by default, a 'Mapper' will be generated.

cosmosName string

Defaults to the 'CodeGeneration.CosmosName' configuration property (its default value is 'ICosmosDb').

cosmosModel string
cosmosContainerId string
cosmosPartitionKey string

Defaults to 'PartitionKey.None'.

cosmosValueContainer boolean
cosmosMapperInheritsFrom string
cosmosCustomMapper boolean

Otherwise, by default, a 'Mapper' will be generated.

odataName string

Defaults to the 'CodeGeneration.ODataName' configuration property (its default value is 'IOData').

odataModel string
odataCollectionName string

The underlying 'Simple.OData.Client' will attempt to infer.

odataMapperInheritsFrom string
odataCustomMapper boolean

Otherwise, by default, a 'Mapper' will be generated.

httpAgentName string

Defaults to 'CodeGeneration.HttpAgentName' configuration property (its default value is 'IHttpAgent').

httpAgentRoutePrefix string

This is the base (prefix) 'URI' for the HTTP Agent endpoint and can be further extended when defining the underlying 'Operation'(s).

httpAgentModel string

This can be overridden within the 'Operation'(s).

httpAgentReturnModel string

This can be overridden within the 'Operation'(s).

dataSvcCaching boolean

Defaults to 'true'.

dataSvcCtor string

Defaults to 'Public'.

Values: "Public" "Private" "Protected"
dataSvcCtorParams string[]

Each constructor parameter should be formatted as 'Type' + '^' + 'Name'; e.g. 'IConfiguration^Config'. Where the 'Name' portion is not specified it will be inferred. Where the 'Type' matches an already inferred value it will be ignored.

dataSvcExtensions boolean

This can be overridden using 'Operation.DataSvcExtensions'.

eventPublish string

Defaults to the 'CodeGeneration.EventPublish' configuration property (inherits) where not specified. Used to enable the sending of messages to the likes of EventGrid, Service Broker, SignalR, etc. This can be overridden within the 'Operation'(s).

Values: "None" "DataSvc" "Data"
eventOutbox string

Defaults to 'CodeGeneration.EventOutbox' configuration property (inherits) where not specified. A value of 'Database' will result in the 'DatabaseEventOutboxInvoker' being used to orchestrate.

Values: "None" "Database"
eventSource string

Defaults to 'Name' (as lowercase) appended with the '/{$key}' placeholder. Note: when used in code-generation the 'CodeGeneration.EventSourceRoot' will be prepended where specified. To include the entity id/key include a '{$key}' placeholder ('Create', 'Update' or 'Delete' operation only); for example: 'person/{$key}'. This can be overridden for the 'Operation'.

eventSubjectFormat string

Defaults to 'CodeGeneration.EventSubjectFormat'.

Values: "NameOnly" "NameAndKey"
eventCasing string

Defaults to 'CodeGeneration.EventCasing'.

Values: "None" "Lower" "Upper"
eventTransaction boolean

Usage will force a rollback of any underlying data transaction (where the provider supports TransactionScope) on failure, such as an 'EventPublish' error. This is by no means implying a Distributed Transaction (DTC) should be invoked; this is only intended for a single data source that supports a TransactionScope to guarantee reliable event publishing. Defaults to 'CodeGeneration.EventTransaction'. This essentially defaults the 'Operation.DataSvcTransaction' where not otherwise specified. This should only be used where 'EventPublish' is 'DataSvc' and a transactionally-aware data source is being used.

managerCtor string

Defaults to 'Public'.

Values: "Public" "Private" "Protected"
managerCtorParams string[]

Each constructor parameter should be formatted as 'Type' + '^' + 'Name'; e.g. 'IConfiguration^Config'. Where the 'Name' portion is not specified it will be inferred. Where the 'Type' matches an already inferred value it will be ignored.

managerExtensions boolean

This can be overridden using 'Operation.ManagerExtensions'.

validator string

Only used for defaulting the 'Create' and 'Update' operation types ('Operation.Type') where not specified explicitly.

iValidator string

Only used for defaulting the 'Create' and 'Update' operation types ('Operation.Type') where not specified explicitly.

webApiRoutePrefix string

This is the base (prefix) 'URI' for the entity and can be further extended when defining the underlying 'Operation'(s). The 'CodeGeneration.WebApiRoutePrefix' will be prepended where specified.

webApiAuthorize string

Defaults to the 'CodeGeneration.WebApiAuthorize' configuration property (inherits) where not specified; can be overridden at the 'Operation' level also.

webApiCtor string

Defaults to 'Public'.

Values: "Public" "Private" "Protected"
webApiCtorParams string[]

Each constructor parameter should be formatted as 'Type' + '^' + 'Name'; e.g. 'IConfiguration^Config'. Where the 'Name' portion is not specified it will be inferred. Where the 'Type' matches an already inferred value it will be ignored.

webApiAutoLocation boolean

This will automatically set the 'Operation.WebApiLocation' for an 'Operation' named 'Create' where there is a corresponding named 'Get'. This is defaulted from the 'CodeGen.WebApiAutoLocation'.

webApiConcurrency boolean

This provides an alternative where the underlying data source does not natively support optimistic concurrency (native support should always be leveraged as a priority). Where the 'Operation.Type' is 'Update' or 'Patch', the request ETag will be matched against the response for a corresponding 'Get' operation to verify no changes have been made prior to updating. For this to function correctly the .NET response Type for the 'Get' must be the same as that returned from the corresponding 'Create', 'Update' and 'Patch' (where applicable) as the generated ETag is a SHA256 hash of the resulting JSON. This defaults the 'Operation.WebApiConcurrency'.

webApiGetOperation string

Defaults to 'Get'. Specify either just the method name (e.g. 'OperationName') or, interface and method name (e.g. 'IXxxManager.OperationName') to be invoked where in a different 'YyyManager.OperationName'.

dataModel boolean

The model will be generated with 'OmitEntityBase = true'. Any reference data properties will be defined using their 'RefDataType' intrinsic 'Type' versus their corresponding (actual) reference data 'Type'.

excludeEntity boolean
excludeAll boolean

Is a shorthand means for setting all of the other 'Exclude*' properties (with the exception of 'ExcludeEntity') to exclude.

excludeIData boolean
excludeData string

Defaults to 'Include' indicating not to exlude. A value of 'Exclude' indicates to exclude all output; alternatively, 'RequiresMapper' indicates to at least output the corresponding 'Mapper' class.

Values: "Include" "Exclude" "RequiresMapper"
excludeIDataSvc boolean
excludeDataSvc boolean
excludeIManager boolean
excludeManager boolean
excludeWebApi boolean
excludeWebApiAgent boolean
excludeGrpcAgent boolean
authRole string

Used where not overridden specifically for an 'Operation'; i.e. acts as the default.

grpc boolean

gRPC support is an explicit opt-in model (see 'CodeGeneration.Grpc' configuration); therefore, each corresponding 'Property' and 'Operation' will also need to be opted-in specifically.

properties Property[]
operations Operation[]
consts Const[]
Property object

The 'Property' object defines an 'Entity' property and its charateristics.

name string required
text string

By default the 'Text' will be the 'Name' reformatted as sentence casing. Depending on whether the 'Type' is 'bool', will appear in one of the two generated sentences. Where not 'bool' it will be: Gets or sets a value indicating whether {text}.'. Otherwise, it will be: Gets or sets the {text}.'. To create a '' within use moustache shorthand (e.g. {{Xxx}}).

modelText string

By default the 'ModelText' will be the 'Name' reformatted as sentence casing. Depending on whether the 'Type' is 'bool', will appear in one of the two generated sentences. Where not 'bool' it will be: Gets or sets a value indicating whether {text}.'. Otherwise, it will be: Gets or sets the {text}.'. To create a '' within use moustache shorthand (e.g. {{Xxx}}).

type string

Defaults to 'string'. To reference a Reference Data 'Type' always prefix with 'RefDataNamespace' (e.g. 'RefDataNamespace.Gender') or shortcut '^' (e.g. '^Gender'). This will ensure that the appropriate Reference Data 'using' statement is used. Shortcut: Where the 'Type' starts with (prefix) 'RefDataNamespace.' or '^', and the correspondong 'RefDataType' attribute is not specified it will automatically default the 'RefDataType' to 'string.'

nullable boolean
inherited boolean
privateName string

Overrides the 'Name' to be used for private fields. By default reformatted from 'Name'; e.g. 'FirstName' as '_firstName'.

argumentName string

Overrides the 'Name' to be used for argument parameters. By default reformatted from 'Name'; e.g. 'FirstName' as 'firstName'.

uniqueKey boolean

This is also used to simplify the parameter specification for an Entity Operation by inferrence.

isEntity boolean

Will be inferred (default to 'true') where the 'Type' is 'ChangeLog' or the 'Type' is found as another 'Entity' within the code-generation configuration file.

immutable boolean
dateTimeTransform string

Defaults to 'UseDefault'. This is only applied where the 'Type' is 'DateTime'.

Values: "UseDefault" "None" "DateOnly" "DateTimeLocal" "DateTimeUtc" "DateTimeUnspecified"
stringTrim string

Defaults to 'UseDefault'. This is only applied where the 'Type' is 'string'.

Values: "UseDefault" "None" "Start" "End" "Both"
stringTransform string

Defaults to 'UseDefault'. This is only applied where the 'Type' is 'string'.

Values: "UseDefault" "None" "NullToEmpty" "EmptyToNull"
autoCreate boolean
default string

Where the 'Type' is 'string' then the specified default value will need to be delimited. Any valid value assignment C# code can be used.

partitionKey boolean

This will implement 'IPartitionKey' for the generated entity.

secondaryPropertyChanged string
bubblePropertyChanges boolean

Note that the 'IsEntity' property is also required to enable.

excludeCleanup boolean
internalOnly boolean

This is only applicable where the 'Entity.EntityScope' is 'Autonomous'. In this instance the 'Property' will be excluded from the 'Common' entity declaration.

refDataType string

Defaults to 'string' (being the 'ReferenceDataBase.Code') where not specified and the corresponding 'Type' starts with (prefix) 'RefDataNamespace.' or '^'. Note: an 'Id' of type 'string' is currently not supported; the use of the 'Code' is the recommended approach.

Values: "string" "int" "Guid"
refDataList boolean

This is required to enable a list of Reference Data values (as per 'RefDataType') to be passed as an argument for example.

refDataText boolean

This is used where serializing within the Web API 'Controller' and the 'ExecutionContext.IsRefDataTextSerializationEnabled' is set to 'true' (which is automatically set where the url contains '$text=true').

refDataMapping boolean

Mapped properties are a special Reference Data property type that ensure value uniqueness; this allows the likes of additional to/from mappings to occur between systems where applicable.

jsonName string

Defaults to 'ArgumentName' where not specified (i.e. camelCase); however, where the property is 'ETag' it will default to the 'Config.ETagJsonName'.

jsonDataModelName string

Defaults to 'JsonName' where not specified.

serializationIgnore boolean

All properties are serialized by default.

serializationEmitDefault boolean
dataModelJsonName string

Defaults to 'JsonName' where not specified.

identifierGenerator string

Should be formatted as 'Type' + '^' + 'Name'; e.g. 'IGuidIdentifierGenerator^GuidIdGen'. Where the 'Name' portion is not specified it will be inferred. Where the 'Type' matches an already inferred value it will be ignored. See 'Beef.Entities.IInt32IdentifierGenerator', 'Beef.Entities.IInt64IdentifierGenerator', 'Beef.Entities.IGuidIdentifierGenerator' or 'Beef.Entities.IStringIdentifierGenerator' for underlying implementation requirements.

dataName string

Defaults to the property 'Name'. Represents the column name for a 'Database', or the correspinding property name for the other options.

dataConverter string

A 'Converter' is used to convert a data source value to/from a .NET 'Type' where no standard data conversion can be applied. Where this value is suffixed by '' or '{T}' this will automatically set 'DataConverterIsGeneric' to 'true'.

dataConverterIsGeneric boolean
dataMapperIgnore boolean

All properties are included by default.

dataAutoGenerated boolean
dataOperationTypes string

Defaults to 'Any'.

Values: "Any" "AnyExceptCreate" "AnyExceptUpdate" "AnyExceptGet" "Get" "Create" "Update" "Delete"
databaseMapper string

A 'Mapper' is used to map a data source value to/from a .NET complex 'Type' (i.e. class with one or more properties).

databaseIgnore boolean
databaseDbType string

Overrides the inferred database type; i.e. can specify 'Date' or 'DateTime2', for .NET Type 'System.DateTime'.

entityFrameworkMapper string

Defaults to 'Map' which indicates the property will be explicitly mapped. A value of 'Ignore' will explicitly 'Ignore', whilst a value of 'Skip' will skip code-generated mapping altogether.

Values: "Map" "Ignore" "Skip"
cosmosMapper string

Defaults to 'Map' which indicates the property will be explicitly mapped. A value of 'Ignore' will explicitly 'Ignore', whilst a value of 'Skip' will skip code-generated mapping altogether.

Values: "Map" "Ignore" "Skip"
odataMapper string

Defaults to 'Map' which indicates the property will be explicitly mapped. A value of 'Ignore' will explicitly 'Ignore', whilst a value of 'Skip' will skip code-generated mapping altogether.

Values: "Map" "Ignore" "Skip"
httpAgentMapper string

Defaults to 'Map' which indicates the property will be explicitly mapped. A value of 'Ignore' will explicitly 'Ignore', whilst a value of 'Skip' will skip code-generated mapping altogether.

Values: "Map" "Ignore" "Skip"
displayName string

Defaults to the 'Name' as sentence case.

annotation1 string
annotation2 string
annotation3 string
webApiQueryStringConverter string
grpcFieldNo integer
grpcType string
Operation object

The code generation for an 'Operation' 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 fully customised operations as required.

name string required
type string
Values: "Get" "GetColl" "Create" "Update" "Patch" "Delete" "Custom"
text string

The 'Text' will be defaulted for all the 'Operation.Type' options with the exception of 'Custom'. To create a '' within use moustache shorthand (e.g. {{Xxx}}).

uniqueKey boolean

This simplifies the specification of these properties versus having to declare each specifically.

paging boolean
valueType string

Defaults to the parent 'Entity.Name' where the 'Operation.Type' options are 'Create' or 'Update'.

returnType string

Defaults to the parent 'Entity.Name' where the 'Operation.Type' options are 'Get', 'GetColl', 'Create' or 'Update'; otherwise, defaults to 'void'.

returnTypeNullable boolean

This is only applicable for an 'Operation.Type' of 'Custom'. Will be inferred where the 'ReturnType' is denoted as nullable; i.e. suffixed by a '?'.

returnText string

A default will be created where not specified. To create a '' within use moustache shorthand (e.g. {{Xxx}}).

privateName string

Overrides the 'Name' to be used for private usage. By default reformatted from 'Name'; e.g. 'GetByArgs' as '_getByArgs'.

autoImplement string

Defaults to 'Entity.AutoImplement'. The corresponding 'Entity.AutoImplement' must be defined for this to be enacted. Auto-implementation is applicable for all 'Operation.Type' options with the exception of 'Custom'.

Values: "Database" "EntityFramework" "Cosmos" "OData" "HttpAgent" "None"
dataEntityMapper string

Used where the default generated 'Mapper' is not applicable.

dataExtensions boolean

Defaults to 'Entity.DataExtensions'.

dataTransaction boolean

Where using an 'EventOutbox' this is ignored as it is implied through its usage.

databaseStoredProc string

Defaults to 'sp' + 'Entity.Name' + 'Operation.Name'; e.g. 'spPersonCreate'.

cosmosContainerId string

Overrides the 'Entity.CosmosContainerId'.

cosmosPartitionKey string

Overrides the 'Entity.CosmosPartitionKey'.

odataCollectionName string

Overriddes the 'Entity.ODataCollectionName'; otherwise, the underlying 'Simple.OData.Client' will attempt to infer.

httpAgentRoute string

This is appended to the 'Entity.HttpAgentRoutePrefix'.

httpAgentMethod string

Defaults to 'Operation.WebApiMethod'.

Values: "HttpGet" "HttpPost" "HttpPut" "HttpDelete" "HttpPatch"
httpAgentModel string

This can be overridden within the 'Operation'(s).

httpAgentReturnModel string

Defaults to 'Operation.HttpAgentModel' where the 'Operation.ReturnType' is equal to 'Entity.Name' (same type). This can be overridden within the 'Operation'(s).

managerCustom boolean
managerTransaction boolean
managerExtensions boolean

Defaults to 'Entity.ManagerExtensions'.

validator string

Defaults to the 'Entity.Validator' where not specified explicitly. Only used for 'Operation.Type' options 'Create' or 'Update'.

iValidator string

Defaults to the 'Entity.IValidator' where specified; otherwise, defaults to 'IValidator<{Type}>' where the '{Type}' is 'ValueType'. Only used 'Operation.Type' options 'Create' or 'Update'.

managerOperationType string

The default will be inferred from the 'Operation.Type'; however, where the 'Operation.Type' is 'Custom' it will default to 'Unspecified'.

Values: "Create" "Read" "Update" "Delete" "Unspecified"
dataSvcCustom boolean
dataSvcTransaction boolean
dataSvcExtensions boolean

Defaults to 'Entity.ManagerExtensions'.

eventPublish string

Defaults to the 'Entity.EventPublish' configuration property (inherits) where not specified. Used to enable the sending of messages to the likes of EventGrid, Service Broker, SignalR, etc.

Values: "None" "DataSvc" "Data"
eventOutbox string

Defaults to 'Entity.EventOutbox' configuration property (inherits) where not specified and 'EventPublish' is 'Data'; otherwise, 'None'. A value of 'Database' will result in the 'DatabaseEventOutboxInvoker' being used to orchestrate.

Values: "None" "Database"
eventSource string

Defaults to 'Entity.EventSource'. Note: when used in code-generation the 'CodeGeneration.EventSourceRoot' will be prepended where specified. To include the entity id/key include a '{$key}' placeholder ('Create', 'Update' or 'Delete' operation only); for example: 'person/{$key}'.

eventSubject string

The event subject template defaults to '{AppName}.{Entity.Name}', plus each of the unique key placeholders comma separated; e.g. 'Domain.Entity.{id1},{id2}' (depending on whether 'Entity.EventSubjectFormat' is 'NameAndKey' or 'NameOnly'). The event action defaults to 'WebApiOperationType' or 'Operation.Type' where not specified. Multiple events can be raised by specifying more than one subject/action pair separated by a semicolon. E.g. 'Demo.Person.{id}:Create;Demo.Other.{id}:Update'.

webApiRoute string
webApiAuthorize string

Where not specified no attribute output will occur; it will then inherit as supported by .NET.

webApiMethod string

The value defaults as follows: 'HttpGet' for 'Operation.Type' value 'Get' or 'GetColl', 'HttpPost' for 'Operation.Type' value 'Create' or 'Custom', 'HttpPut' for 'Operation.Type' value 'Update', and 'HttpDelete' for 'Operation.Type' value 'Delete'. An 'Operation.Type' value 'Patch' can not be specified and will always default to 'HttpPatch'.

Values: "HttpGet" "HttpPost" "HttpPut" "HttpDelete"
webApiStatus string

The value defaults as follows: 'OK' for 'Operation.Type' value 'Get', 'GetColl', 'Update', 'Delete' or 'Custom', 'Created' for 'Operation.Type' value 'Create'.

Values: "OK" "Accepted" "Created" "NoContent" "NotFound"
webApiAlternateStatus string

The value defaults as follows: 'NotFound' for 'Operation.Type' value 'Get', 'NoContent' for 'Operation.Type' value 'GetColl', 'Create', 'Update' or 'Patch'; otherwise, 'ThrowException' which will result in an 'InvalidOperationException'.

Values: "OK" "Accepted" "Created" "NoContent" "NotFound" "ThrowException"
webApiLocation string

This uses similar formatting to the 'WebApiRoute'. The response value is accessed using 'r.' notation to access underlying properties; for example '{r.Id}' or 'person/{r.Id}'. The 'Entity.WebApiRoutePrefix' will be prepended automatically; however, to disable set the first character to '!', e.g. '!person/{r.Id}'. The URI can be inferred from another 'Operation' by using a lookup '^'; for example '^Get' indicates to infer from the named 'Get' operation (where only '^' is specified this is shorthand for '^Get' as this is the most common value). The Location URI will ensure the first character is a '/' so it acts a 'relative URL absolute path'.

webApiConcurrency boolean

This provides an alternative where the underlying data source does not natively support optimistic concurrency (native support should always be leveraged as a priority). Where the 'Operation.Type' is 'Update' or 'Patch', the request ETag will be matched against the response for a corresponding 'Get' operation to verify no changes have been made prior to updating. For this to function correctly the .NET response Type for the 'Get' must be the same as that returned from the corresponding 'Create', 'Update' and 'Patch' (where applicable) as the generated ETag is a SHA256 hash of the resulting JSON. Defaults to 'Entity.WebApiConcurrency'.

webApiGetOperation string

Defaults to 'Get'. Specify either just the method name (e.g. 'OperationName') or, interface and method name (e.g. 'IXxxManager.OperationName') to be invoked where in a different 'YyyManager.OperationName'.

webApiUpdateOperation string

Defaults to 'Update'. Specify either just the method name (e.g. 'OperationName') or, interface and method name (e.g. 'IXxxManager.OperationName') to be invoked where in a different 'YyyManager.OperationName'.

authPermission string
authRole string
excludeAll boolean

Is a shorthand means for setting all of the other 'Exclude*' properties to 'true'.

excludeIData boolean
excludeData boolean
excludeIDataSvc boolean
excludeDataSvc boolean
excludeIManager boolean
excludeManager boolean
excludeWebApi boolean
excludeWebApiAgent boolean
excludeGrpcAgent boolean
grpc boolean

gRPC support is an explicit opt-in model (see 'CodeGeneration.Grpc' configuration); therefore, each corresponding 'Entity', 'Property' and 'Operation' will also need to be opted-in specifically.

parameters Parameter[]
Parameter object

The 'Parameter' object defines an 'Operation' parameter and its charateristics.

name string required
text string

By default the 'Text' will be the 'Name' reformatted as sentence casing.

type string

Defaults to 'string'. To reference a Reference Data 'Type' always prefix with 'RefDataNamespace' (e.g. 'RefDataNamespace.Gender') or shortcut '^' (e.g. '^Gender'). This will ensure that the appropriate Reference Data 'using' statement is used. Shortcut: Where the 'Type' starts with (prefix) 'RefDataNamespace.' or '^', and the correspondong 'RefDataType' attribute is not specified it will automatically default the 'RefDataType' to 'string.'

nullable boolean
default string

Where the 'Type' is 'string' then the specified default value will need to be delimited. Any valid value assignment C# code can be used.

privateName string

Overrides the 'Name' to be used for private fields. By default reformatted from 'Name'; e.g. 'FirstName' as '_firstName'.

argumentName string

Overrides the 'Name' to be used for argument parameters. By default reformatted from 'Name'; e.g. 'FirstName' as 'firstName'.

property string
refDataType string

Defaults to 'string' where not specified and the corresponding 'Type' starts with (prefix) 'RefDataNamespace.'.

Values: "string" "int" "Guid"
refDataList boolean

This is required to enable a list of Reference Data values (as per 'RefDataType') to be passed as an argument for example.

validator string
iValidator string

Defaults to 'IValidator<{Type}>' where the '{Type}' is 'Type'.

validatorCode string
isMandatory boolean
layerPassing string

Defaults to 'All'. To further describe, 'All' passes the parameter through all layeys, 'ToManagerSet' only passes the parameter to the 'Manager' layer and overrides the same named property within the corresponding 'value' parameter, 'ToManagerCollSet' only passes the parameter to the 'Manager' layer and overrides the same named property within the corresponding 'value' collection parameter. Where using the 'UniqueKey' option to automatically set 'Parameters', and the 'Operation.Type' is 'Create' or 'Update' it will default to 'ToManagerSet'.

Values: "All" "ToManagerSet" "ToManagerCollSet"
dataConverter string

A 'Converter' is used to convert a data source value to/from a .NET 'Type' where the standard data type conversion is not applicable.

dataConverterIsGeneric boolean
webApiFrom string

Defaults to 'FromQuery'; unless the parameter 'Type' has also been defined as an 'Entity' within the code-gen config file then it will default to 'FromEntityProperties'. Specifies that the parameter will be declared with corresponding 'FromQueryAttribute', 'FromBodyAttribute' or 'FromRouteAttribute' for the Web API method. The 'FromEntityProperties' will declare all properties of the 'Entity' as query parameters.

Values: "FromQuery" "FromBody" "FromRoute" "FromEntityProperties"
grpcType string
Const object

The 'Const' object is used to define a .NET (C#) constant value for an 'Entity'.

name string required
value string required

The code generation will ensure the value is delimited properly to output correctly formed (delimited) .NET (C#) code.

text string

By default the 'Text' will be the 'Name' reformatted as sentence casing. It will be formatted as: 'Represents a {text} constant value.' To create a '' within use moustache shorthand (e.g. '{{Xxx}}').