on 01-13-2023 1:34 PM
Hello CAP Team,
when looking at the documentation regarding Aspects:
https://cap.cloud.sap/docs/guides/domain-models#aspects
https://cap.cloud.sap/docs/cds/cdl#aspects
I don't find any information how I could define a bound action in an aspect. Is it correct to say that aspects are only intended for the data model but not for the service layer? What option do I have to define a reusable action?
Best Regards
Gregor
Hi,
you can use actions on aspects similar to entities, e.g.:
aspect A {} actions { action A(); }
You can then re-use this aspect via the include-mechanism. Though its main use may be to have re-usable elements, you can define aspects that only have actions or annotations as well. Aspects without elements can even be use to extend projections (in more recent cds-compiler versions), e.g.
aspect A {} actions { action A(); }
entity E { key id : String; };
entity P as projection on E;
extend P with A;
Kind regards,
Andre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
11 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.