HAKOM.Persistence.Core.Net Assembly
Provides core abstractions for persistence operations, including repository management, storage provider abstractions, caching, versioning, and reference handling.
Remarks
Section titled “Remarks”This assembly defines the fundamental building blocks for interacting with data stores in a provider-agnostic manner. Concrete storage provider implementations (Oracle, SQL Server, PostgreSQL) are provided by separate assemblies that build upon these abstractions.
Key concepts:- Repository — A named data store configured via IRepositoryConfiguration. Repositories are loaded by name through IRepositoryStore<TRepository>.
- Storage Provider — An IStorageProvider encapsulates the connection to a specific storage backend. Providers are created by IStorageProviderFactory based on configuration.
- Store — An IStore<TStorageProvider> provides read/write access to data within a specific storage provider.
- Reference — An IReference<TReferred> is a lazy-loading pointer to a persisted object that can be resolved on demand.
- Caching — An ICache<TCacheEntry> provides in-memory caching for frequently accessed data, backed by Microsoft.Extensions.Caching.Memory.IMemoryCache.
- Versioning — The IRepositoryVersionProvider retrieves version information from repositories to ensure client-server compatibility.
Register the persistence services with the dependency injection container using the extension methods in ContainerExtensions.
// Configure the DI container with persistence servicescontainer .UseConfiguredRepositories() .UseStorageProviderFactory() .UseStorageInformationFactory() .UseRepositoryVersionProvider() .EnableMemoryCache();Register a concrete storage provider for a specific database type:
container .UseStorageProvider<OracleStorageProvider>("Oracle");Load a repository by name through the repository store:
IRepositoryStore<ITsmRepository> repositoryStore = ...;ITsmRepository repository = await repositoryStore .Load("MyRepository", cancellationToken);Enable caching for repository information:
container .UseRepositoryInformationCache<ITsmRepositoryInformation>();| Namespaces | |
|---|---|
| HAKOM.Persistence.Core.Net.Api | Contains the public API for the persistence core, including repository abstractions, repository information management, and base implementations for repositories and stores. The central types in this namespace are: … |
| HAKOM.Persistence.Core.Net.Api.Caching | Provides caching abstractions and base implementations for reducing the number of storage access operations by keeping frequently used data in memory. The caching system is built around the following types: … |
| HAKOM.Persistence.Core.Net.Api.Configuration | Provides interfaces for repository configuration, including how repositories are named, what storage provider they use, and how configuration is loaded. Key types: … |
| HAKOM.Persistence.Core.Net.Api.Configuration.Exceptions | Contains exceptions related to repository configuration errors, such as missing names, incomplete configurations, or missing required settings. All exceptions in this namespace inherit from HakomException and map to HTTP 500 (Internal Server Error), as they indicate server-side misconfiguration. |
| HAKOM.Persistence.Core.Net.Api.Exceptions | Contains exceptions related to repository lifecycle operations, including initialization failures, repository lookup failures, unsupported repositories, and storage provider type mismatches. All exceptions in this namespace inherit from HakomException and provide appropriate HTTP status code mappings via EquivalentHttpStatusCode. |
| HAKOM.Persistence.Core.Net.Api.Extensions | Provides extension methods for registering persistence services with the IContainer and for creating authorization resources. ContainerExtensions is the primary entry point for configuring the persistence layer in the dependency injection container. ResourceFactoryExtensions provides convenience methods for creating repository-scoped authorization resources. |
| HAKOM.Persistence.Core.Net.Api.Ordering | Provides types for defining ordering rules when querying items from a store. The Order<TResult> struct allows specifying which property to order by and in which Direction (ascending, descending, or unspecified). Ordering expressions are validated to ensure they consist only of simple property accesses. |
| HAKOM.Persistence.Core.Net.Api.Ordering.Exceptions | Contains exceptions thrown when invalid ordering expressions are used with Order<TResult>. The InvalidOrderExpressionException is thrown when an expression is not a simple property-accessing expression (e.g., method calls or constants are not allowed). |
| HAKOM.Persistence.Core.Net.Api.Paging | Provides types for defining paging (range) parameters when querying items from a store. The Range<TResult> struct specifies a start and optional end index for result sets, supporting conversion to offset/limit parameters for use with SQL-based stores. |
| HAKOM.Persistence.Core.Net.Api.References | Provides interfaces for lazy-loading references to persisted objects and for parsing a value that addresses an object either by its name or by its identifier. References allow stores to return lightweight pointers to data that can be resolved (loaded) on demand. Key types: … |
| HAKOM.Persistence.Core.Net.Api.References.Serialization.Json | Provides JSON serialization support for IReference<TReferred> instances, including handling of IStorageInformation and identifier properties during serialization and deserialization. The JsonReferenceSerializer<TReferred,TReference> abstract class handles the common logic for serializing references to and from JSON, including support for resolved references that carry their value inline. |
| HAKOM.Persistence.Core.Net.Api.References.Serialization.Json.Exceptions | Contains exceptions thrown during reference serialization and deserialization operations. The NoDefaultStorageInformationAvailableException is thrown when no storage information is provided during deserialization and no IDefaultStorageInformationProvider<TReference> has been registered. |
| HAKOM.Persistence.Core.Net.Api.Storage | Provides the storage provider abstraction layer, including interfaces and base classes for storage providers, stores, storage information, and reader/writer factories. Key types: … |
| HAKOM.Persistence.Core.Net.Api.Storage.Configuration | Contains the configuration interface for storage providers. The IStorageProviderConfiguration defines the type of storage provider, its connection settings, and optional elevated settings for administrative operations. |
| HAKOM.Persistence.Core.Net.Api.Storage.Exceptions | Contains exceptions related to storage operations. The StoreIsReadonlyException is thrown when attempting to access the writer of a Store<TStorageProvider,TStorageReader,TStorageWriter> that was initialized without a writer factory. |
| HAKOM.Persistence.Core.Net.Api.Versioning | Provides interfaces for repository version management, including version retrieval, version collections, and version compatibility checking. Key types: … |
| HAKOM.Persistence.Core.Net.Api.Versioning.Exceptions | Contains exceptions thrown during repository version retrieval operations. … |
Was this page helpful?Thanks for your feedback!