on 04-19-2023 1:44 PM
Hello together,
I am new to CAP and I am wondering if there is an easy way to handle defined CDS models in an object orientated way so that I can define methods on those objects. My goal is to implement a central behavior of an object that can be used by services and background jobs.
Regards
Jens
Jens, I can only speak for Node.js, but there you have the ApplicationService object that your custom handlers extend. So you can build JensApplicationService, extend Application Service and have your handlers extend JenApplicationService.
...
export default class HcmCoreService extends cds.ApplicationService {
...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same applies to CAP Java. You can also express a certain amount of logic within CDS views. Benefit here would be that this logic is already executed on the DB layer. Drawback is that you need to be careful with that wrt. to performance when doing so. Other than that you can of course just implement handlers for your entities (or whole services) that would then be executed on corresponding events.
Hi Jens and Martin,
Please also see our Actions API. We generate JS functions to call based on action definitions in your model.
Best,
Sebastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.