IPowerPortalsProService

The IPowerPortalsProService interface provides methods for performing CRUD operations, executing queries, managing relationships, and retrieving metadata from Dataverse. It is the primary service for server-side data access in PowerPortalsPro.

Note

In most cases you do not need to call IPowerPortalsProService directly. The RecordContext, MainContext, and grid components handle data operations automatically. Use this service for custom logic that falls outside the standard component workflow.

Server and Client Implementations

IPowerPortalsProService ships with two implementations registered automatically by the framework — your component code is identical against both, and the runtime injects whichever one matches the active render context:

  • Server implementation (PowerPortalsPro.Web.Server, registered by AddPowerPortalsProWebServer) — runs in-process, talks to Dataverse directly through IOrganizationService, and applies your ITablePermissionHandler / ITableRecordPermissionHandler interceptors before any read or write. Selected when the page renders under InteractiveServerRenderMode or static SSR.
  • Client implementation (PowerPortalsPro.Web.Client, registered by AddPowerPortalsProWebClient) — runs in the browser under WebAssembly, has no Dataverse SDK at all, and instead JSON-serializes each call out to the corresponding server-side HTTP endpoint (/api/table/{name}, /api/retrieveMultiple, etc.). Permission handlers still apply because the request lands back on the server's endpoint. See the Client API page for the wire format and the routes the client implementation calls.

Because the contract is identical, the same component works under any interactivity mode (Server, WebAssembly, or Auto). Code that calls _powerPortalsProService.RetrieveRecordAsync(...) in a Server-rendered page does an in-process Dataverse call; the same line in a WASM-rendered page issues an HTTP request — no branching required.

Injecting the Service

Inject IPowerPortalsProService into any Blazor component or service via constructor or property injection.

React
Blazor

Retrieving a Record

Use RetrieveRecordAsync to fetch a single record by table name and ID. Optionally specify which columns to return; if omitted, all columns are returned.

React
Blazor

Querying Multiple Records

Use RetrieveRecordsAsync with a FetchXML query string to retrieve multiple records with filtering, sorting, and linked entity support.

React
Blazor

Creating a Record

Use CreateRecordAsync to create a new record in Dataverse. The response contains the ID of the newly created record.

React
Blazor

Updating a Record

Use UpdateRecordAsync to update an existing record. Only the properties set on the TableRecord are sent to Dataverse.

React
Blazor

Deleting a Record

Use DeleteRecordAsync to delete a record by table name and ID.

React
Blazor

Associating Records

Use AssociateAsync and DisassociateAsync to manage many-to-many relationships between records.

React
Blazor

Executing Requests

Use ExecuteAsync for a single request or ExecuteMultipleAsync to execute multiple requests in a single database transaction. If any request in a transactional batch fails, all changes are rolled back.

React
Blazor

Retrieving Metadata

Use RetrieveTableMetadataAsync and RetrieveViewMetadataAsync to retrieve table and view metadata. For cached access, prefer ITableMetadataCache and IViewMetadataCache instead.

React
Blazor

Working with Files

Use GetFileInfoAsync to retrieve file or image metadata and optionally the binary content from a file or image column.

React
Blazor

IPowerPortalsProService Interface

Methods

Name
Parameters
Type
Description
AssociateAsyncTableRecordReference record
string relationshipName
IEnumerable<TableRecordReference> relatedRecords
EntityRole? role
Task<AssociateResponse>
Associates a record with one or more related records via a many-to-many relationship.
ClearAllCachesAsyncTask<IReadOnlyList<CacheClearResult>>
Clears every server-side Services.IClearableCache (table / view / privilege metadata, per-user privileges, environment-file settings) and rebuilds the localized-strings cache atomically — readers continue to see the previously loaded data until the new state is fully populated. Lazy caches refill on the next request that needs them. The HTTP endpoint behind this call is gated by [Authorize(Roles = 'SystemAdmin')]. Server-side direct callers should gate appropriately at their own boundary.
ClearCacheAsyncstring name
Task<CacheClearResult>
Clears one named cache. Returns null when no registered cache matches name (case-insensitive); failures are wrapped in the result rather than thrown. Same auth gate as IPowerPortalsProService.ClearAllCachesAsync.
CreateFileArchiveAsyncCreateFileArchiveRequest request
Task<FileArchiveResult>
Builds an archive (currently zip; future formats live behind the CreateFileArchiveRequest.Format enum) containing every record's file payload for the named table / column pair. Uses the same per-record permission chain as String,System.Boolean) — unauthorized / missing rows are silently dropped from the archive. Duplicate filenames are disambiguated by suffixing ' (2)', ' (3)', … so the archive never overwrites entries.
CreateRecordAsyncTableRecord record
Task<CreateResponse>
Creates a new record in Dataverse.
DeleteRecordAsyncstring tableLogicalName
Guid id
Task<DeleteResponse>
Deletes a record from Dataverse by table name and record ID.
DisassociateAsyncTableRecordReference record
string relationshipName
IEnumerable<TableRecordReference> relatedRecords
EntityRole? role
Task<DisassociateResponse>
Removes an association between a record and one or more related records via a many-to-many relationship.
DownloadLocalizationSourceAsyncstring sourceId
string culture
Task<LocalizationDownload>
Downloads the keys one source contributed to one culture during the most recent warmup, as JSON in the same nested-object shape consumer app.{culture}.json files use. Intended for translation handoff — hand the file to a translator, get back a translated version, drop it in a localization folder where it overrides whatever the original source provided for those keys.
DownloadMergedLocalizationsAsyncstring culture
Task<LocalizationDownload>
Downloads the merged localization keys for one culture — the post-merge winning value for every key the cache has stored, regardless of which source originally supplied it. Use this for a complete-snapshot reference (everything the portal will actually serve for that culture) rather than the per-source view above.
ExecuteAsyncOrganizationRequest request
Task<OrganizationResponse>
Executes a single organization request against Dataverse.
ExecuteMultipleAsyncIEnumerable<OrganizationRequest> requests
bool returnResponses
Task<List<OrganizationResponse>>
Executes multiple organization requests in a single database transaction. If any request fails, all changes in the batch are rolled back.
GetCacheNamesAsyncTask<IReadOnlyList<string>>
Returns the names of every server-side Services.IClearableCache, suitable for an admin UI that wants to render per-cache clear buttons. Same auth gate as IPowerPortalsProService.ClearAllCachesAsync applies on the HTTP endpoint.
GetFileInfoAsyncstring tableName
Guid recordId
string columnName
bool includeData
Task<FileInfo>
Retrieves file information and optionally the binary content from a file or image column in Dataverse.
GetFileInfosAsyncstring tableName
IEnumerable<Guid> recordIds
string columnName
bool includeData
Task<IEnumerable<FileInfo>>
Batched retrieval of file information for many records of the same table / column in a single round trip. Internally fans the per-record fetches out in parallel and returns the combined list. The same per-record permission-handler chain runs as for the single-record call; failed lookups are dropped from the response rather than failing the whole batch. Used by FileGrid's 'Download All' / 'Download Selected' so the client can build a zip without firing N HTTP requests.
GetLocalizationOverviewAsyncTask<LocalizationOverview>
Returns an admin-facing snapshot of the string-localization pipeline: the static configuration that drove the warmup plus the per-source load records produced by the most recent warmup. Backs the LocalizationAdmin component in PowerPortalsPro.Web.Blazor.FluentUI. The HTTP endpoint is gated by [Authorize(Roles = 'SystemAdmin')].
GetMergedLocalizationEntriesAsyncstring culture
Task<IReadOnlyList<MergedLocalizationEntry>>
Returns the merged localization keys for one culture as a structured list — every key the cache will serve, its winning post-merge value, and which source supplied that value. Same data as DownloadMergedLocalizationsAsync(System.String) but per-key annotated with its origin (file / web resource / Dataverse metadata) so an admin can inspect provenance in a grid. Entries are sorted by key.
GetOrganizationSettingsAsyncTask<OrganizationSettings>
Retrieves the organization-wide settings sourced from the Dataverse organization record: DefaultCurrency — the org's base currency, used by create-mode editors (MoneyEdit) to render the right symbol on brand-new records. BlockedFileExtensions + MaxUploadFileSizeInBytes — file-upload constraints clients mirror to reject invalid files before the round-trip. Replaces the legacy GetEnvironmentFileSettingsAsync — the two file fields are now exposed on this combined response.
GetTablePermissionsForCurrentUserAsyncstring tableLogicalName
Task<TableSecurityPermission>
Returns the current user's combined table-level Models.TableSecurityPermission mask for tableLogicalName — the bitwise union of Read / Create / Write / Delete / Append / AppendTo flags any registered ITablePermissionHandler allows for that user on that table. Server-side this delegates to the cached ITablePermissionCache; the WASM client hits an HTTP endpoint that calls the same cache on the server. Mirrors the table-cache lookup Blazor's NewRecordGridButton / DeleteRecordGridButton already do directly via DI, and the new value the GridDataResponse carries as TablePermissions — exposed here so consumers outside the grid path (custom toolbars, conditional UI, 'Can the user create X?' gates anywhere on the page) can reach the same answer without firing a grid query.
GetTranslationAvailabilityAsyncTask<TranslationAvailability>
Returns whether the localization-translation feature is usable in the current environment: whether the Azure translation service is configured, whether the translation managed solution is installed, and the candidate target languages (the portal's supported cultures annotated with Azure-translatability). Backs the LocalizationTranslator UI's decision to show the translate panel, an install prompt, or nothing.
RetrieveRecordAsyncstring tableLogicalName
Guid id
IEnumerable<string> columns
Task<TableRecord>
Retrieves a single record from Dataverse by table name and record ID.
RetrieveRecordsAsyncstring fetchXml
Task<RetrieveRecordsResponse>
Retrieves multiple records from Dataverse using a FetchXML query. Supports filtering, sorting, paging, linked entities, and aggregate queries.
RetrieveTableMetadataAsyncstring tableLogicalName
Task<TableMetadata>
Retrieves table metadata from Dataverse, including column definitions, relationships, and display configuration.
RetrieveViewMetadataAsyncGuid viewId
Task<ViewMetadata>
Retrieves view metadata from Dataverse, including the view's FetchXML query, columns, and display configuration.
RetrieveViewsForTableAsyncstring tableLogicalName
Task<IEnumerable<ViewMetadata>>
Retrieves every view metadata record for a table. Used by grids that need to enumerate the available views (view-picker, default-view resolution, etc.). The server-side implementation reads from the in-process IViewMetadataCache; the WASM client hits an HTTP endpoint that does the same on the server.
TranslateLocalizationFileAsyncTranslationRequest request
Task<TranslationResult>
Machine-translates an uploaded localization file into one or more target languages via Azure Translator, reusing the Dataverse translation memory and reporting how many strings were freshly translated versus reused. Returns one file per target language plus a zip of all.
UpdateRecordAsyncTableRecord record
Task<UpdateResponse>
Updates an existing record in Dataverse. Only the properties set on the record are sent to Dataverse.
Name: AssociateAsync
Parameters: TableRecordReference record
string relationshipName
IEnumerable<TableRecordReference> relatedRecords
EntityRole? role
Type: Task<AssociateResponse>
Description: Associates a record with one or more related records via a many-to-many relationship.
Name: ClearAllCachesAsync
Type: Task<IReadOnlyList<CacheClearResult>>
Description: Clears every server-side Services.IClearableCache (table / view / privilege metadata, per-user privileges, environment-file settings) and rebuilds the localized-strings cache atomically — readers continue to see the previously loaded data until the new state is fully populated. Lazy caches refill on the next request that needs them. The HTTP endpoint behind this call is gated by [Authorize(Roles = 'SystemAdmin')]. Server-side direct callers should gate appropriately at their own boundary.
Name: ClearCacheAsync
Parameters: string name
Type: Task<CacheClearResult>
Description: Clears one named cache. Returns null when no registered cache matches name (case-insensitive); failures are wrapped in the result rather than thrown. Same auth gate as IPowerPortalsProService.ClearAllCachesAsync.
Name: CreateFileArchiveAsync
Parameters: CreateFileArchiveRequest request
Type: Task<FileArchiveResult>
Description: Builds an archive (currently zip; future formats live behind the CreateFileArchiveRequest.Format enum) containing every record's file payload for the named table / column pair. Uses the same per-record permission chain as String,System.Boolean) — unauthorized / missing rows are silently dropped from the archive. Duplicate filenames are disambiguated by suffixing ' (2)', ' (3)', … so the archive never overwrites entries.
Name: CreateRecordAsync
Parameters: TableRecord record
Type: Task<CreateResponse>
Description: Creates a new record in Dataverse.
Name: DeleteRecordAsync
Parameters: string tableLogicalName
Guid id
Type: Task<DeleteResponse>
Description: Deletes a record from Dataverse by table name and record ID.
Name: DisassociateAsync
Parameters: TableRecordReference record
string relationshipName
IEnumerable<TableRecordReference> relatedRecords
EntityRole? role
Type: Task<DisassociateResponse>
Description: Removes an association between a record and one or more related records via a many-to-many relationship.
Name: DownloadLocalizationSourceAsync
Parameters: string sourceId
string culture
Type: Task<LocalizationDownload>
Description: Downloads the keys one source contributed to one culture during the most recent warmup, as JSON in the same nested-object shape consumer app.{culture}.json files use. Intended for translation handoff — hand the file to a translator, get back a translated version, drop it in a localization folder where it overrides whatever the original source provided for those keys.
Name: DownloadMergedLocalizationsAsync
Parameters: string culture
Type: Task<LocalizationDownload>
Description: Downloads the merged localization keys for one culture — the post-merge winning value for every key the cache has stored, regardless of which source originally supplied it. Use this for a complete-snapshot reference (everything the portal will actually serve for that culture) rather than the per-source view above.
Name: ExecuteAsync
Parameters: OrganizationRequest request
Type: Task<OrganizationResponse>
Description: Executes a single organization request against Dataverse.
Name: ExecuteMultipleAsync
Parameters: IEnumerable<OrganizationRequest> requests
bool returnResponses
Type: Task<List<OrganizationResponse>>
Description: Executes multiple organization requests in a single database transaction. If any request fails, all changes in the batch are rolled back.
Name: GetCacheNamesAsync
Type: Task<IReadOnlyList<string>>
Description: Returns the names of every server-side Services.IClearableCache, suitable for an admin UI that wants to render per-cache clear buttons. Same auth gate as IPowerPortalsProService.ClearAllCachesAsync applies on the HTTP endpoint.
Name: GetFileInfoAsync
Parameters: string tableName
Guid recordId
string columnName
bool includeData
Type: Task<FileInfo>
Description: Retrieves file information and optionally the binary content from a file or image column in Dataverse.
Name: GetFileInfosAsync
Parameters: string tableName
IEnumerable<Guid> recordIds
string columnName
bool includeData
Type: Task<IEnumerable<FileInfo>>
Description: Batched retrieval of file information for many records of the same table / column in a single round trip. Internally fans the per-record fetches out in parallel and returns the combined list. The same per-record permission-handler chain runs as for the single-record call; failed lookups are dropped from the response rather than failing the whole batch. Used by FileGrid's 'Download All' / 'Download Selected' so the client can build a zip without firing N HTTP requests.
Name: GetLocalizationOverviewAsync
Type: Task<LocalizationOverview>
Description: Returns an admin-facing snapshot of the string-localization pipeline: the static configuration that drove the warmup plus the per-source load records produced by the most recent warmup. Backs the LocalizationAdmin component in PowerPortalsPro.Web.Blazor.FluentUI. The HTTP endpoint is gated by [Authorize(Roles = 'SystemAdmin')].
Name: GetMergedLocalizationEntriesAsync
Parameters: string culture
Type: Task<IReadOnlyList<MergedLocalizationEntry>>
Description: Returns the merged localization keys for one culture as a structured list — every key the cache will serve, its winning post-merge value, and which source supplied that value. Same data as DownloadMergedLocalizationsAsync(System.String) but per-key annotated with its origin (file / web resource / Dataverse metadata) so an admin can inspect provenance in a grid. Entries are sorted by key.
Name: GetOrganizationSettingsAsync
Type: Task<OrganizationSettings>
Description: Retrieves the organization-wide settings sourced from the Dataverse organization record: DefaultCurrency — the org's base currency, used by create-mode editors (MoneyEdit) to render the right symbol on brand-new records. BlockedFileExtensions + MaxUploadFileSizeInBytes — file-upload constraints clients mirror to reject invalid files before the round-trip. Replaces the legacy GetEnvironmentFileSettingsAsync — the two file fields are now exposed on this combined response.
Name: GetTablePermissionsForCurrentUserAsync
Parameters: string tableLogicalName
Type: Task<TableSecurityPermission>
Description: Returns the current user's combined table-level Models.TableSecurityPermission mask for tableLogicalName — the bitwise union of Read / Create / Write / Delete / Append / AppendTo flags any registered ITablePermissionHandler allows for that user on that table. Server-side this delegates to the cached ITablePermissionCache; the WASM client hits an HTTP endpoint that calls the same cache on the server. Mirrors the table-cache lookup Blazor's NewRecordGridButton / DeleteRecordGridButton already do directly via DI, and the new value the GridDataResponse carries as TablePermissions — exposed here so consumers outside the grid path (custom toolbars, conditional UI, 'Can the user create X?' gates anywhere on the page) can reach the same answer without firing a grid query.
Name: GetTranslationAvailabilityAsync
Type: Task<TranslationAvailability>
Description: Returns whether the localization-translation feature is usable in the current environment: whether the Azure translation service is configured, whether the translation managed solution is installed, and the candidate target languages (the portal's supported cultures annotated with Azure-translatability). Backs the LocalizationTranslator UI's decision to show the translate panel, an install prompt, or nothing.
Name: RetrieveRecordAsync
Parameters: string tableLogicalName
Guid id
IEnumerable<string> columns
Type: Task<TableRecord>
Description: Retrieves a single record from Dataverse by table name and record ID.
Name: RetrieveRecordsAsync
Parameters: string fetchXml
Type: Task<RetrieveRecordsResponse>
Description: Retrieves multiple records from Dataverse using a FetchXML query. Supports filtering, sorting, paging, linked entities, and aggregate queries.
Name: RetrieveTableMetadataAsync
Parameters: string tableLogicalName
Type: Task<TableMetadata>
Description: Retrieves table metadata from Dataverse, including column definitions, relationships, and display configuration.
Name: RetrieveViewMetadataAsync
Parameters: Guid viewId
Type: Task<ViewMetadata>
Description: Retrieves view metadata from Dataverse, including the view's FetchXML query, columns, and display configuration.
Name: RetrieveViewsForTableAsync
Parameters: string tableLogicalName
Type: Task<IEnumerable<ViewMetadata>>
Description: Retrieves every view metadata record for a table. Used by grids that need to enumerate the available views (view-picker, default-view resolution, etc.). The server-side implementation reads from the in-process IViewMetadataCache; the WASM client hits an HTTP endpoint that does the same on the server.
Name: TranslateLocalizationFileAsync
Parameters: TranslationRequest request
Type: Task<TranslationResult>
Description: Machine-translates an uploaded localization file into one or more target languages via Azure Translator, reusing the Dataverse translation memory and reporting how many strings were freshly translated versus reused. Returns one file per target language plus a zip of all.
Name: UpdateRecordAsync
Parameters: TableRecord record
Type: Task<UpdateResponse>
Description: Updates an existing record in Dataverse. Only the properties set on the record are sent to Dataverse.