Persistence Repositories
This page documents the repository APIs currently implemented in Moongate.Persistence.
Repository Interfaces
IAccountRepository
Supports:
AddAsync(UOAccountEntity)UpsertAsync(UOAccountEntity)RemoveAsync(Serial)GetByIdAsync(Serial)GetByUsernameAsync(string)GetAllAsync()CountAsync()ExistsAsync(predicate)QueryAsync(predicate, selector)
IMobileRepository
Supports:
UpsertAsync(UOMobileEntity)RemoveAsync(Serial)GetByIdAsync(Serial)GetAllAsync()CountAsync()QueryAsync(predicate, selector)
IItemRepository
Supports:
UpsertAsync(UOItemEntity)RemoveAsync(Serial)GetByIdAsync(Serial)GetAllAsync()CountAsync()QueryAsync(predicate, selector)
IBulletinBoardMessageRepository
Supports:
UpsertAsync(BulletinBoardMessageEntity)RemoveAsync(Serial messageId)GetByIdAsync(Serial messageId)GetByBoardIdAsync(Serial boardId)GetAllAsync()CountAsync()
IHelpTicketRepository
Supports:
UpsertAsync(HelpTicketEntity)RemoveAsync(Serial ticketId)GetByIdAsync(Serial ticketId)GetBySenderCharacterIdAsync(Serial senderCharacterId)GetAllAsync()CountAsync()
Notes:
BoardIdis the bulletin-board item serialMessageIdis the persisted serial-like identifier for a post/reply- replies are linked through
ParentId - owner checks use
OwnerCharacterId
Unit Of Work
IPersistenceUnitOfWork exposes:
- repositories (
Accounts,Mobiles,Items,BulletinBoardMessages,HelpTickets) - generic repository access (
GetRepository<TEntity, TKey>()) - id allocation (
AllocateNextAccountId,AllocateNextMobileId,AllocateNextItemId) - lifecycle (
InitializeAsync,SaveSnapshotAsync) - registry-driven snapshot capture / replay for every registered entity descriptor
For registering a new entity kind and using the generic repository path, see How to Add and Use a Custom Persisted Entity.
Runtime Behavior
- Repositories operate against in-memory
PersistenceStateStore. - Mutations append journal entries through
BinaryJournalService. PersistenceUnitOfWork.InitializeAsyncloads snapshot then replays journal.SaveSnapshotAsyncwrites a full bucket-based snapshot and trims journal entries included in that capture.
Thread Safety
Repository operations synchronize through state-store locking to ensure consistency of:
- entity dictionaries
- username index
- last-id and sequence counters
Previous: Data Format | Next: Custom Persisted Entities