v2.7 (latest)
Persisted Entities Language Reference ​
These are the methods available when using Persisted Entities programmatically. These are divided into: Instance Methods and Static Methods.
Instance Methods ​
Instance methods are called on an instance of a Persisted Entity. These methods allow you to interact with the data and perform actions specific to a particular instance, such as saving changes, deleting the entity, or retrieving specific attributes.
| Method | Description |
|---|---|
| save() | Saves the instances. Can be used on new instances or to update an existing instance. For instance, calling it twice in a row on a new instance will first create a new entry in the database, followed by updating it. |
| delete() | Deletes the instance from the database. Only works on entities that already exist in the database. |
| setId(guid) | Sets the ID of the entity. Only useful in certain circumstances. Saving or fetching entities will automatically set the ID. |
| getId() | Returns the ID of the entity. |
Static Methods ​
Static methods are called on the Entity class itself, not on a specific instance. These methods are useful for actions that do not pertain to a particular entity instance, such as creating a new entity, listing all entities, finding entities by certain criteria, or deleting multiple entities.
| Method | Description |
|---|---|
| getAll(meta, entityFilter) meta: { pageIndex: number, pageSize: number, sortBy: string } entityFilter: { type: 'Equals' | 'And' |
| get(id) | Gets a single instance by ID |
| save(entities) | Saves an array of entities and returns the saved instances. |
| delete(meta, entityFilter) meta: { createdFrom: date, createdTo: date, modifiedFrom: date, modifiedTo: date } entityFilter: { type: 'Equals' | 'And' |