How do you execute SQL in an app behavior?

In a business object behavior, I just do this.execute(sql,params,options). What is the equivalent in an App Behavior?

To execute SQL in an App Behavior, you’ll need to get a reference to the data source object. A couple ways to do so are:

this.app.dataSources['datasource-name'].execute
// If you include a business object (ex: MyObject) as a dependency, then:
MyObject._staticRepository.dataSource.execute
1 Like

in a reusable behavior, the line:
this.app.dataSources[‘datasource-name’].execute
Is not valid, but removing the ‘this’ on the front is also not valid.
How are reusable behaviors different in this respect?

need to pass in ‘this.app’ (as an any), as it’s not available in a utility function