Settings for scaffolding out an entity for your Web API.
A list of database entities in your project. These entities are added as dbsets to your database context, so they translate 1:1 to tables in your database.
|Name||Yes||The name of the entity||None|
|Properties||Yes||A list of properties assigned to your entity described in the entity properties section.||None|
|Features||Yes||This is a list of features that you want to add for a particular entity.||None|
|Plural||No||The plural of the entity name, if needed (e.g. ||Entity Name appended with an |
|Lambda||No||The value to use in lambda expressions for this entity.||First letter of the entity name.|
|TableName||No||The name of the table in the database.||Defaulted to the singular |
|Schema||No||The schema to use in the database.||None, which will equate to |
A list of properties that can be assigned to an entity.
|Name||Yes||The name of the property||None|
|Type||Yes||The data type for the property. These are not case sensitive and they can be set to nullable with a trailing ||None|
|IsPrimaryKey||Yes||When true, the property will be set as the primary key for the entity. For now, only one primary key is supported, with plans to add compound key support down the road.||false|
|CanFilter||No||Will set the property to be filterable in the API endpoint when set to true.||false|
|CanSort||No||Will set the property to be filterable in the API endpoint when set to true.||false|
|IsRequired||No||When true, the property will be set as required in the database.||false|
true for primary key
|ColumnName||No||The database field name for the given property.||None|
|CanManipulate||No||When set to false, you will not be able to update this property when calling the associated endpoint. When set to ||true|
false for primary key
|DefaultValue||No||Allows you to add a default value to a property. Note that it should be entered exactly as you'd want it, so a string would be something like ||None|
|Type||Yes||The type of feature you want to add. The accepted values are ||None|
AddRecord are all standard CRUD features along with their endpoints and associated tests.
ℹ DTOs, validators, profiles and functional test routes associated to all features will be added regardless of whether or not a given feature was added. This is due to the complexity of all the minute management around handling these so dynamically. Feel free to delete whatever you're not using.
You can also add ad hoc skeletons with the
AdHoc type. For
AdHoc features, there's a bit more that needs to be done. In addition to
Type above, you'll want to provide the below:
|Name||Yes||The name of the feature. This is the name of the feature's method and would generally be something like ||None|
|Command||Yes||The name of the command. This is the name of the feature's class and would generally be something like ||[NAME]Command|
|EntityPlural||No (but recommended)||The plural name of the entity that the feature will be added to (should match the name in the ||""|
|ResponseType||No||Is the type of response that this command will return. This could be any C# type that you want, or even a custom type if you want, but in that case, you'll need to add a using statement for it manually.||bool|
You can also add
AdHocfeatures after the fact using the
This example would create a supplier entity with several properties. Note:
SupplierIdis marked as a primary key
PatchRecord. We're also adding an
AdHocfeature for use for batch adding suppliers.
Entities: - Name: Supplier Features: - Type: AddRecord - Type: GetRecord - Type: GetList - Type: UpdateRecord - Type: DeleteRecord - Type: AdHoc Name: BatchAddSuppliers Command: BatchAddSuppliersCommand EntityPlural: Suppliers Properties: - Name: SupplierId IsPrimaryKey: true Type: int CanFilter: true CanSort: true - Name: Name Type: string CanFilter: true CanSort: true - Name: EmployeeCount Type: int? CanFilter: true CanSort: true - Name: CreationDate Type: datetime? CanFilter: true CanSort: true - Name: SupplierType Type: int? CanFilter: true CanSort: true - Name: IsVip Type: bool? CanFilter: true CanSort: true DefaultValue: false
For the time being, composite keys can not be created using Craftsman commands. With that said, you are more than welcome to scaffold out an entity with one of the keys and then modify the generated entity, repository, tests, etc. to accommodate that composite key.