Class CharacterPortalService
Persists the portals a character has activated for themselves, as per-scene bitmask pages.
public sealed class CharacterPortalService : BaseService<CharacterPortalEntity>, ICharacterPortalService, IFetchCollectionByKeyAction<long, CharacterPortalData>, IDeleteByKeyAction<long>
- Inheritance
-
CharacterPortalService
- Implements
- Inherited Members
Remarks
A copy of CharacterWaypointService over its own table rather than a shared
table with a "kind" column: the two index spaces are authored separately (a waypoint and a
portal may both be index 0 in a scene), and keeping them apart keeps the waypoint row's key
and every query over it unchanged. The mask is ulong in the game and
bigint here; the two's-complement reinterpretation is done in this class only.
Constructors
CharacterPortalService(INpgsqlDbContextFactory)
public CharacterPortalService(INpgsqlDbContextFactory dbContextFactory)
Parameters
dbContextFactoryINpgsqlDbContextFactory
Methods
DeleteAsync(long, CancellationToken)
Deletes the entity identified by the given key.
public Task<DatabaseResult> DeleteAsync(long characterId, CancellationToken cancellationToken = default)
Parameters
characterIdlongcancellationTokenCancellationTokenToken to cancel the operation.
Returns
Remarks
Hard-deletes every page the character has. The foreign key cascades too; this exists for an explicit purge.
FetchAsync(long, CancellationToken)
Fetches a collection of items for the given key.
public Task<DatabaseResult<IReadOnlyList<CharacterPortalData>>> FetchAsync(long characterId, CancellationToken cancellationToken = default)
Parameters
characterIdlongcancellationTokenCancellationTokenToken to cancel the operation.
Returns
MergeAsync(IEnumerable<CharacterPortalData>, CancellationToken)
OR-merges pages into the stored masks, creating rows that do not exist yet.
public Task<DatabaseResult> MergeAsync(IEnumerable<CharacterPortalData> pages, CancellationToken cancellationToken = default)
Parameters
pagesIEnumerable<CharacterPortalData>The pages to merge. Bits already stored are retained.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DatabaseResult>
Success, or the failure that stopped the whole batch.