Hungry for knowledge: MetadataStore vs. TagMetadataStore


Why do we use MetadataStore.tag() vs. TagMetadataStore directly? can you drop some knowledge on this question?


TagMetadataStore, as well as AllMetadataStore and PackageMetadataStore, are simply a type definition for different kinds of MetadataStores and because they contain member methods a user should act on an instance of that type similar to an non-static class in other languages. In order to keep consistency, we have created a one stop shop and single entry point called MetadataStore to perform general metadata functionality and access the different instances of the MetadataStore.

Long story short, is it possible to call TagMetadataStore direct, yes, but the convention and best practice is to retrieve the instance of TagMetadataStore for the current tenant/tag through MetadataStore so there is no question you are acting on the correct instance of metadata.