Object wrapper
Create a system object wrapper.
You are advised not to use this interface to directly operate OS objects. Instead, you are advised to use the system SDK encapsulated by the platform. For example, to query system parameters, use getParameter.
Note: You do not need to useObject decoration. When an app is packaged, the metadata definition of the object is not packaged.
setup
is for system objects, object
is for standard objects, custom objects.
The core difference between the two is that most system objects are cached in the process private cache for
performance purposes, while standard objects and custom objects are not cached.
If a record is queried by ID, the setup process directly queries the result from the cache,
and the object process needs to query the result from the database. Therefore, the setup process is much faster.
During batch deletion and update, setup performance is poor. When setup objects are deleted and records are updated,
special processing is required. Therefore, batch deletion cannot be directly performed at the database layer.
The implementation of setup.updateByCondition
and setup.deleteByCondition
is as follows:
step 1 Call object.queryByCondition
to query all id that meet the condition from the database
step 2 Delete and update one by one according to id list.
import * as db from 'db';
class Demo {
run(): void {
let s = db.setup('CustomResource');
}
}
Object name. You can specify a system object.