ctx.makeResource()
Creates and returns a new resource instance without writing to or modifying ctx.resource. It is suitable for scenarios requiring multiple independent resources or temporary usage.
Use Cases
If you only need a single resource and want to bind it to ctx.resource, using ctx.initResource() is more appropriate.
Type Definition
Returns: The newly created resource instance.
Difference from ctx.initResource()
Examples
Single resource
Multiple resources
Temporary query
Notes
- The newly created resource needs to call
setResourceName(name)to specify the collection, and then load data viarefresh(). - Each resource instance is independent and does not affect others; suitable for loading multiple data sources in parallel.
Related
- ctx.initResource(): Initialize and bind to
ctx.resource - ctx.resource: The resource instance in the current context
- MultiRecordResource — Multiple records/List
- SingleRecordResource — Single record
- APIResource — General API resource
- SQLResource — SQL query resource

