Merk
Tilgang til denne siden krever autorisasjon. Du kan prøve å logge på eller endre kataloger.
Tilgang til denne siden krever autorisasjon. Du kan prøve å endre kataloger.
Views are supported as alternatives to tables in DAB. A view can be exposed through REST or GraphQL endpoints with minimal configuration.
Configuration
To expose a view:
- Set
source.typeto"view" - Set
source.objectto the fully qualified view name - Define
key-fieldsto identify a row uniquely - Grant permission using the
"read"action (and optionally"create","update","delete"if the view is updatable)
CLI example
dab add BookDetail \
--source dbo.vw_books_details \
--source.type "view" \
--source.key-fields "id" \
--permissions "anonymous:read"
Configuration example
"BookDetail": {
"source": {
"type": "view",
"object": "dbo.vw_books_details",
"key-fields": [ "id" ]
},
"permissions": [
{
"role": "anonymous",
"actions": [ "read" ]
}
]
}
REST support
- Supports all REST verbs:
GET,POST,PUT,PATCH,DELETE - Default behavior is identical to table-backed entities
- Operations succeed only if the view is updatable and appropriate permissions are set
Example request
GET /api/BookDetail/42
Returns the row from vw_books_details with id = 42.
GraphQL support
- View appears as a GraphQL type
- Queries are always supported
- Mutations are supported only if the view is updatable
- Follows standard DAB GraphQL schema structure
Permissions
- Use the
readaction for readonly views - Use
create,update, anddeleteonly if the view is updatable
Limitations
key-fieldsare required- Views do not support relationships
- Pagination, filtering, and sorting are supported if the view behaves like a table