1 Plugin Examples
Julian edited this page 2020-09-28 20:35:30 -04:00

JavaScript Examples

Meta Service

The Meta Service allows you to store your own key-value pairs in the EFMeta table under the database you are using. This is helpful when building a plugin that requires persistent data storage and retrieval. Each key-value pair is stored under a client ID.

this.manager = manager;
this.serviceResolver = _serviceResolver;

// Resolve IMetaService to a variable
this.metaService = this.serviceResolver.ResolveService("IMetaService");
// Get the owner of the data by client ID
var owner = this.manager.GetClientService().Get(clientID).Result
// Store some data under the owner
this.metaService.AddPersistentMeta("my_data", "My Data Value"), owner).Result
// Fetch a value by its key
var data = this.metaService.GetPersistentMeta("my_data", owner).Result.Value;