From 57552fe76d6662de9b5c326f9b5fb3e8ceda067d Mon Sep 17 00:00:00 2001 From: Steffen Weinstock <79531202+stewsk@users.noreply.github.com> Date: Mon, 11 Mar 2024 12:13:15 +0100 Subject: [PATCH] Clarify namespace, clarify relation service - entity (#730) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Clarify namespace, clarify relation service - entity * a namespace is not an object * relation entity/service is established via name * split codeblock * edit * Update cds/cdl.md Co-authored-by: René Jeglinsky * Update cds/cdl.md Co-authored-by: René Jeglinsky * Update cds/cdl.md --------- Co-authored-by: Rene Jeglinsky --- cds/cdl.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cds/cdl.md b/cds/cdl.md index 591918d89..778a9fe97 100644 --- a/cds/cdl.md +++ b/cds/cdl.md @@ -1539,6 +1539,29 @@ GET: /OrderWithParameter(foo=5)/Set or GET: /OrderWithParameter(5)/Set GET: /ViewInService(p1=5, p2=true)/Set ``` +To expose an entity, it's not necessary to be lexically enclosed in the service definition. An entity's affiliation to a service is established using its fully qualified name, so you can also use one of the following options: + +- Add a namespace. +- Use the service name as prefix. + +In the following example, all entities belong to/are exposed by the same service: + +::: code-group +```cds [myservice.cds] +service foo.MyService { + entity A { /*...*/ }; +} +entity foo.MyService.B { /*...*/ }; +``` +::: + +::: code-group +```cds [another.cds] +namespace foo.MyService; +entity C { /*...*/ }; +``` +::: + ### (Auto-) Redirected Associations {#auto-redirect} @@ -1770,6 +1793,7 @@ entity Bar : Foo {} //> foo.bar.Bar ``` ::: +A namespace is not an object of its own. There is no corresponding definition in CSN. ### The `context` Directive {#context}