Skip to content

Commit

Permalink
use bookshop
Browse files Browse the repository at this point in the history
  • Loading branch information
renejeglinsky authored Feb 27, 2024
1 parent c4ed6cd commit f6c87a6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions node.js/cds-reflect.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,32 +474,32 @@ class cds.type extends any {...}
These properties are convenience shortcuts to access a service definition's exposed *entity*, *type*, *event*, *action* or *function* definitions. Their values are *iterable* objects which allow both, access by relative name as well as iterating through all definitions. For example, given a service definition like that:

```cds
service Sue {
entity Foo {}
entity Bar {}
service CatalogService {
entity Books {}
entity Authors {}
}
```

And got a reference to the service definition, e.g. like that:

```js
let { Sue } = cds.linked(model).definitions
let { CatalogService } = cds.linked(model).definitions
```

You can reflect the entities in any of these ways:

```js
let { Foo, Bar } = Sue.entities
let { Books, Authors } = CatalogService.entities
```

```js
let [ Foo, Bar ] = Sue.entities
let [ Books, Authors ] = CatalogService.entities
```

```js
for (let each of Sue.entities) console.log (each.name)
//> Sue.Foo
//> Sue.Bar
for (let each of CatalogService.entities) console.log (each.name)
//> CatalogService.Books
//> CatalogService.Authors
```


Expand Down

0 comments on commit f6c87a6

Please sign in to comment.