CachedMetadataProvider
- Namespace:
PPDS.Dataverse.Metadata - Assembly:
PPDS.Dataverse - Kind: Class
- Implements:
ICachedMetadataProvider,IDisposable
Summary
Provides cached access to Dataverse metadata, wrapping PPDS.Dataverse.Metadata.IMetadataQueryService
with per-session caching to minimize round-trips.
Members
Constructors
CachedMetadataProvider(IMetadataQueryService metadataService)
CachedMetadataProvider(IMetadataQueryService metadataService)
Creates a new PPDS.Dataverse.Metadata.CachedMetadataProvider.
- Param
metadataService: The underlying metadata service.
Methods
Dispose
void Dispose()
(inherited from System.IDisposable.Dispose)
GetAttributesAsync
Task<IReadOnlyList<AttributeMetadataDto>> GetAttributesAsync(string entityLogicalName, CancellationToken ct)
Gets attributes for an entity. Lazy-loaded on first access and cached with a 5-minute TTL.
-
Param
entityLogicalName: The entity logical name. -
Param
ct: Cancellation token. -
Returns: List of attribute metadata.
GetEntitiesAsync
Task<IReadOnlyList<EntitySummary>> GetEntitiesAsync(CancellationToken ct)
Gets all entities from cache. The entity list is populated by PPDS.Dataverse.Metadata.ICachedMetadataProvider.PreloadAsync(System.Threading.CancellationToken)
and cached indefinitely for the session lifetime.
-
Param
ct: Cancellation token. -
Returns: List of entity summaries.
GetRelationshipsAsync
Task<EntityRelationshipsDto> GetRelationshipsAsync(string entityLogicalName, CancellationToken ct)
Gets relationships for an entity. Lazy-loaded on first access and cached with a 5-minute TTL.
-
Param
entityLogicalName: The entity logical name. -
Param
ct: Cancellation token. -
Returns: Entity relationships grouped by type.
InvalidateAll
void InvalidateAll()
Invalidates all cached metadata. The next access will re-fetch from Dataverse.
InvalidateEntity
void InvalidateEntity(string entityLogicalName)
Invalidates cached metadata for a specific entity (attributes and relationships). The entity list cache is not affected.
- Param
entityLogicalName: The entity logical name to invalidate.
InvalidateEntityList
void InvalidateEntityList()
Invalidates the cached entity list. The next call to PPDS.Dataverse.Metadata.ICachedMetadataProvider.GetEntitiesAsync(System.Threading.CancellationToken)
will re-fetch from Dataverse. Use after table create/delete operations.
InvalidateGlobalOptionSets
void InvalidateGlobalOptionSets()
Invalidates any cached global option set data. Currently a no-op since global option sets are not cached, but provides a stable API for cache invalidation after global choice create/update/delete operations.
PreloadAsync
Task PreloadAsync(CancellationToken ct)
Eagerly loads the entity list into cache. Call this early (e.g., on environment connect) so that entity names are available for IntelliSense without delay.
- Param
ct: Cancellation token.