Interface IRepository
- Namespace
- combit.Reporting.Repository
- Assembly
- combit.ListLabel31.CrossPlatform.dll
Represents a storage for the files that a List & Label project depends on, e.g. drilldown projects, includes, images, shapefiles, etc. Once a repository is active, those external files are referenced via an ID instead of local file paths. The IRepository implementation is responsible for storing and loading the contents and metadata information ("descriptor") of the items in the repository.
public interface IRepository
Methods
ContainsItem(string)
Returns if the item with the specified ID exists in the repository.
bool ContainsItem(string id)
Parameters
idstringID of the repository item.
Returns
CreateOrUpdateItem(RepositoryItem, string?, Stream?)
Stores a new or modified item in the repository.
void CreateOrUpdateItem(RepositoryItem item, string? importData, Stream? sourceStream)
Parameters
itemRepositoryItemAn object containing the repository item metadata. Note that this is always a new instance of the RepositoryItem type.
importDatastringIf this call was triggered by a file import, this contains the userData parameter of the import call. Otherwise this parameter is null.
sourceStreamStreamA stream that the file content of the repository item can be read from. If this parameter is null, the current file content of the repository item must not be modified (i.e. save the metadata in the 'item' parameter only, but ignore the file content)!
DeleteItem(string)
Deletes the repository item with the specified ID.
void DeleteItem(string id)
Parameters
idstringID of the repository item.
GetAllItems()
Returns a list of all items in the repository.
IEnumerable<RepositoryItem> GetAllItems()
Returns
GetItem(string)
Returns a single repository item. If the item does not exist, null should be returned.
RepositoryItem? GetItem(string id)
Parameters
idstringID of the repository item.
Returns
LoadItem(string, Stream, CancellationToken)
Loads the contents of the file and writes it to the destinationStream.
void LoadItem(string id, Stream destinationStream, CancellationToken cancelToken)
Parameters
idstringID of the repository item.
destinationStreamStreamStream that the file content of the repository item must be written to.
cancelTokenCancellationTokenA token that indicates if the user has requested to cancel the load operation.
LockItem(string)
Gets called when an item of the repository is loaded to be edited (i.e. project files) to lock it for exclusive access. Usually other users should not be able to edit the item at the same time. Return false in case the item is already locked by an other user (no blocking lock!), or true if the lock was acquired or is not needed. It is advisable to implement a fallback in case UnlockItem() does not get called (e.g. due to an error).
bool LockItem(string id)
Parameters
idstringID of the repository item.
Returns
UnlockItem(string)
Releases a lock for an item which was previouly locked for editing. Do not rely on UnlockItem() getting called for each item locked by LockItem(). Use an additional timeout or other fallback mechanism to release the locks.
void UnlockItem(string id)
Parameters
idstringID of the repository item.