# RCommon — Full API Reference > This file contains the complete public API surface of every RCommon.* package: every public > type and member, with signatures and XML doc-comment summaries. > Generated by Tools/RCommon.ApiReferenceGenerator by reflecting over built assemblies plus their > .xml doc-comment sidecars -- not hand-authored, so it will not go stale relative to the code. > For prose documentation, see https://rcommon.com/llms-full.txt --- ## RCommon.Amazon.S3Objects ### Namespace RCommon.Amazon.S3Objects #### class AmazonS3ObjectsBuilder Concrete builder that registers Amazon S3 services into the DI container. Constructor accepts RCommon.IRCommonBuilder (required by Activator.CreateInstance pattern). ##### `AmazonS3ObjectsBuilder(IRCommonBuilder builder)` ##### `AddBlobStore(String name, Action options) : IAmazonS3ObjectsBuilder` ##### `Services : IServiceCollection` #### class AmazonS3StorageService Amazon S3 implementation of Blobs.IBlobStorageService. Wraps S3.IAmazonS3 from the AWSSDK.S3 package. ##### `AmazonS3StorageService(IAmazonS3 client)` ##### `ContainerExistsAsync(String containerName, CancellationToken token) : Task` ##### `CopyAsync(String sourceContainer, String sourceBlob, String destContainer, String destBlob, CancellationToken token) : Task` ##### `CreateContainerAsync(String containerName, CancellationToken token) : Task` ##### `DeleteAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `DeleteContainerAsync(String containerName, CancellationToken token) : Task` ##### `DownloadAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `ExistsAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `GetPresignedDownloadUrlAsync(String containerName, String blobName, TimeSpan expiry, CancellationToken token) : Task` ##### `GetPresignedUploadUrlAsync(String containerName, String blobName, TimeSpan expiry, CancellationToken token) : Task` ##### `GetPropertiesAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `ListBlobsAsync(String containerName, String prefix, CancellationToken token) : Task>` ##### `ListContainersAsync(CancellationToken token) : Task>` ##### `MoveAsync(String sourceContainer, String sourceBlob, String destContainer, String destBlob, CancellationToken token) : Task` ##### `SetMetadataAsync(String containerName, String blobName, IDictionary metadata, CancellationToken token) : Task` ##### `UploadAsync(String containerName, String blobName, Stream content, BlobUploadOptions options, CancellationToken token) : Task` #### class AmazonS3StoreOptions Configuration options for a named Amazon S3 blob store. ##### `AmazonS3StoreOptions()` ##### `AccessKeyId : String` ##### `ForcePathStyle : Boolean` Required for S3-compatible stores that don't support virtual-hosted-style addressing. ##### `Profile : String` AWS credentials profile name. Uses CredentialProfileStoreChain for resolution. ##### `Region : String` ##### `SecretAccessKey : String` ##### `ServiceUrl : String` Service URL for S3-compatible stores (MinIO, LocalStack). #### interface IAmazonS3ObjectsBuilder Builder interface for configuring Amazon S3 as an Blobs.IBlobStorageService provider. ##### `AddBlobStore(String name, Action options) : IAmazonS3ObjectsBuilder` --- ## RCommon.ApplicationServices ### Namespace RCommon #### class CqrsBuilderExtensions Extension methods for RCommon.IRCommonBuilder and ApplicationServices.ICqrsBuilder that provide fluent registration of CQRS infrastructure, command handlers, and query handlers. ##### `AddCommand(ICqrsBuilder builder) : Void` Registers a command handler as a transient service. This is an alias for CqrsBuilderExtensions.AddCommandHandler``3 with a command-first type parameter order. - `builder`: The CQRS builder. ##### `AddCommandHandler(ICqrsBuilder builder) : Void` Registers a command handler as a transient service for the specified command and result types. - `builder`: The CQRS builder. ##### `AddCommandHandlers(ICqrsBuilder builder, Assembly fromAssembly, Predicate predicate) : Void` ##### `AddCommandHandlers(ICqrsBuilder builder, Type[] commandHandlerTypes) : Void` Registers the specified command handler types as transient services. - `builder`: The CQRS builder. - `commandHandlerTypes`: The command handler types to register. ##### `AddCommandHandlers(ICqrsBuilder builder, IEnumerable commandHandlerTypes) : Void` ##### `AddQuery(ICqrsBuilder builder) : Void` Registers a query handler as a transient service. This is an alias for CqrsBuilderExtensions.AddQueryHandler``3 with a query-first type parameter order. - `builder`: The CQRS builder. ##### `AddQueryHandler(ICqrsBuilder builder) : Void` Registers a query handler as a transient service for the specified query and result types. - `builder`: The CQRS builder. ##### `AddQueryHandlers(ICqrsBuilder builder, Type[] queryHandlerTypes) : Void` Registers the specified query handler types as transient services. - `builder`: The CQRS builder. - `queryHandlerTypes`: The query handler types to register. ##### `AddQueryHandlers(ICqrsBuilder builder, Assembly fromAssembly, Predicate predicate) : Void` ##### `AddQueryHandlers(ICqrsBuilder builder, IEnumerable queryHandlerTypes) : Void` ##### `AddUnitOfWorkToCommandBus(ICqrsBuilder builder) : Void` Wraps every ICommandBus.DispatchCommandAsync call in an Transactions.IUnitOfWork, committed automatically after a successful dispatch -- the native-bus equivalent of RCommon.Mediatr's AddUnitOfWorkToRequestPipeline(). Opt-in; scoped to commands only, since Queries.IQueryBus is untouched (queries are read-only by CQRS convention). - `builder`: The CQRS builder. ##### `WithCQRS(IRCommonBuilder builder) : IRCommonBuilder` Adds CQRS support using the specified ApplicationServices.ICqrsBuilder implementation with default configuration. - `builder`: The RCommon builder. - Returns: The builder for further chaining. ##### `WithCQRS(IRCommonBuilder builder, Action actions) : IRCommonBuilder` ### Namespace RCommon.ApplicationServices #### class CqrsBuilder Default implementation of ApplicationServices.ICqrsBuilder that registers the core CQRS services (Commands.ICommandBus and Queries.IQueryBus) into the dependency injection container. ##### `CqrsBuilder(IRCommonBuilder builder)` Initializes a new instance of ApplicationServices.CqrsBuilder and registers the default CQRS services. - `builder`: The RCommon builder providing access to the service collection. ##### `Services : IServiceCollection` #### class CqrsCachingOptions Configuration options for caching behavior within the CQRS pipeline. ##### `CqrsCachingOptions()` Initializes a new instance of ApplicationServices.CqrsCachingOptions with caching disabled. ##### `UseCacheForHandlers : Boolean` Gets or sets a value indicating whether resolved handler metadata should be cached. #### class CqrsValidationOptions Configuration options that control whether automatic validation is applied to CQRS commands and queries. ##### `CqrsValidationOptions()` Initializes a new instance of ApplicationServices.CqrsValidationOptions with validation disabled for both commands and queries. ##### `ValidateCommands : Boolean` Gets or sets a value indicating whether commands should be validated before dispatch. ##### `ValidateQueries : Boolean` Gets or sets a value indicating whether queries should be validated before dispatch. #### interface ICqrsBuilder Defines the contract for a builder that configures CQRS (Command Query Responsibility Segregation) services. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register CQRS-related services. #### interface IValidationBuilder Defines the contract for a builder that configures validation services. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register validation-related services. #### class InvalidCacheException Exception thrown when the caching infrastructure is not properly configured or available. ##### `InvalidCacheException(String message)` Initializes a new instance of ApplicationServices.InvalidCacheException with the specified error message. - `message`: A message describing the caching configuration problem. #### class ValidationBuilderExtensions Extension methods for RCommon.IRCommonBuilder and ApplicationServices.IValidationBuilder that provide fluent registration of validation infrastructure. ##### `UseWithCqrs(IValidationBuilder builder, Action options) : Void` ##### `WithValidation(IRCommonBuilder builder) : IRCommonBuilder` Adds validation support using the specified ApplicationServices.IValidationBuilder implementation with default configuration. - `builder`: The RCommon builder. - Returns: The builder for further chaining. ##### `WithValidation(IRCommonBuilder builder, Action actions) : IRCommonBuilder` ### Namespace RCommon.ApplicationServices.Commands #### class CommandBus Default implementation of Commands.ICommandBus that dispatches commands to their registered handlers using the dependency injection container. ##### `CommandBus(ILogger logger, IServiceProvider serviceProvider, IValidationService validationService, IOptions validationOptions, IOptions cachingOptions)` ##### `DispatchCommandAsync(ICommand command, CancellationToken cancellationToken) : Task` #### interface ICommandBus Defines the contract for a command bus that dispatches commands to their corresponding handlers. ##### `DispatchCommandAsync(ICommand command, CancellationToken cancellationToken) : Task` #### interface ICommandHandler Non-generic marker interface for all command handlers. Used for service resolution via reflection. #### interface ICommandHandler Handles commands of specified type. ##### `HandleAsync(TCommand command, CancellationToken cancellationToken) : Task` Handles the specified command asynchronously. - `command`: The command to handle. - `cancellationToken`: Token to observe for cancellation. - Returns: A task representing the asynchronous operation. #### interface ICommandHandler Handles returning commands of specified type. ##### `HandleAsync(TCommand command, CancellationToken cancellationToken) : Task` Handles the specified command asynchronously and returns an execution result. - `command`: The command to handle. - `cancellationToken`: Token to observe for cancellation. - Returns: The execution result produced by handling the command. #### class NoCommandHandlersException Exception thrown when no command handlers are registered for a given command type. ##### `NoCommandHandlersException(String message)` Initializes a new instance of Commands.NoCommandHandlersException with the specified error message. - `message`: A message describing which command type has no registered handlers. #### class UnitOfWorkCommandBus Decorates Commands.ICommandBus so every DispatchCommandAsync call is wrapped in an Transactions.IUnitOfWork, committed automatically after a successful dispatch -- the native-bus equivalent of RCommon.Mediatr's AddUnitOfWorkToRequestPipeline(). Registered only when AddUnitOfWorkToCommandBus() is called; scoped to commands only, since queries are read-only by CQRS convention. ##### `UnitOfWorkCommandBus(ICommandBus inner, IUnitOfWorkFactory unitOfWorkFactory)` Initializes a new instance of Commands.UnitOfWorkCommandBus. - `inner`: The decorated Commands.ICommandBus that actually dispatches to handlers. - `unitOfWorkFactory`: Factory used to create the Transactions.IUnitOfWork wrapping each dispatch. ##### `DispatchCommandAsync(ICommand command, CancellationToken cancellationToken) : Task` ### Namespace RCommon.ApplicationServices.Queries #### interface IQueryBus Defines the contract for a query bus that dispatches queries to their corresponding handlers. ##### `DispatchQueryAsync(IQuery query, CancellationToken cancellationToken) : Task` #### interface IQueryHandler Non-generic marker interface for all query handlers. Used for service resolution via reflection. #### interface IQueryHandler Defines the contract for a handler that processes a specific query type and returns a result. ##### `HandleAsync(TQuery query, CancellationToken cancellationToken) : Task` Handles the specified query asynchronously and returns the result. - `query`: The query to handle. - `cancellationToken`: Token to observe for cancellation. - Returns: The result produced by handling the query. #### class QueryBus Default implementation of Queries.IQueryBus that dispatches queries to their registered handlers using the dependency injection container. ##### `QueryBus(ILogger logger, IServiceProvider serviceProvider, IValidationService validationService, IOptions validationOptions, IOptions cachingOptions)` ##### `DispatchQueryAsync(IQuery query, CancellationToken cancellationToken) : Task` ### Namespace RCommon.ApplicationServices.Validation #### interface IValidationProvider Defines the contract for a validation provider that performs validation against a target object. ##### `ValidateAsync(T target, Boolean throwOnFaults, CancellationToken cancellationToken) : Task` Validates the specified target object asynchronously. - `target`: The object to validate. - `throwOnFaults`: If true, a Validation.ValidationException is thrown when validation fails. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Validation.ValidationOutcome containing any validation faults. #### interface IValidationService Defines the contract for a validation service that orchestrates object validation. ##### `ValidateAsync(T target, Boolean throwOnFaults, CancellationToken cancellationToken) : Task` Validates the specified target object asynchronously. - `target`: The object to validate. - `throwOnFaults`: If true, a Validation.ValidationException is thrown when validation fails. Defaults to false. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Validation.ValidationOutcome containing any validation faults. #### enum Severity Specifies the severity of a rule. ##### `Error : Severity` Error ##### `Info : Severity` Info ##### `Warning : Severity` Warning ##### `value__ : Int32` #### class ValidationException An exception that represents failed validation ##### `ValidationException(String message)` Creates a new Validation.ValidationException with a message and no errors. - `message`: The exception message. ##### `ValidationException(String message, IEnumerable errors)` ##### `ValidationException(String message, IEnumerable errors, Boolean appendDefaultMessage)` ##### `ValidationException(IEnumerable errors)` ##### `Errors : IEnumerable` Validation errors #### class ValidationFault Defines a validation failure ##### `ValidationFault()` Creates a new validation failure. ##### `ValidationFault(String propertyName, String errorMessage)` Creates a new validation failure. - `propertyName`: The name of the property that failed validation. - `errorMessage`: The error message describing the failure. ##### `ValidationFault(String propertyName, String errorMessage, Object attemptedValue)` Creates a new validation failure. - `propertyName`: The name of the property that failed validation. - `errorMessage`: The error message describing the failure. - `attemptedValue`: The value that was rejected by the validation rule. ##### `AttemptedValue : Object` The property value that caused the failure. ##### `CustomState : Object` Custom state associated with the failure. ##### `ErrorCode : String` Gets or sets the error code. ##### `ErrorMessage : String` The error message ##### `FormattedMessagePlaceholderValues : Dictionary` Gets or sets the formatted message placeholder values. ##### `PropertyName : String` The name of the property. ##### `Severity : Severity` Custom severity level associated with the failure. ##### `ToString() : String` Creates a textual representation of the failure. #### class ValidationOutcome The result of running a validator ##### `ValidationOutcome()` Creates a new ValidationResult ##### `ValidationOutcome(IEnumerable failures)` ##### `ValidationOutcome(IEnumerable otherResults)` ##### `Errors : List` A collection of errors ##### `IsValid : Boolean` Whether validation succeeded ##### `RuleSetsExecuted : String[]` The RuleSets that were executed during the validation run. ##### `ToDictionary() : IDictionary` Converts the ValidationResult's errors collection into a simple dictionary representation. - Returns: A dictionary keyed by property name where each value is an array of error messages associated with that property. ##### `ToString() : String` Generates a string representation of the error messages separated by new lines. ##### `ToString(String separator) : String` Generates a string representation of the error messages separated by the specified character. - `separator`: The character to separate the error messages. #### class ValidationService Default implementation of Validation.IValidationService that delegates validation to a scoped Validation.IValidationProvider. ##### `ValidationService(IServiceProvider serviceProvider)` Initializes a new instance of Validation.ValidationService. - `serviceProvider`: The root service provider used to create scoped validation providers. ##### `ValidateAsync(T target, Boolean throwOnFaults, CancellationToken cancellationToken) : Task` --- ## RCommon.Authorization.Web ### Namespace RCommon.Authorization.Web.Filters #### class AuthorizationHeaderParameterOperationFilter A Swashbuckle SwaggerGen.IOperationFilter that adds a required "Authorization" header parameter to every Swagger/OpenAPI operation whose action pipeline includes an Authorization.AuthorizeFilter and does not allow anonymous access. ##### `AuthorizationHeaderParameterOperationFilter()` ##### `Apply(OpenApiOperation operation, OperationFilterContext context) : Void` Applies the filter to the given operation by inspecting the action's filter pipeline for authorization requirements. - `operation`: The OpenAPI operation being processed. - `context`: The filter context containing API description metadata. #### class AuthorizeCheckOperationFilter A Swashbuckle SwaggerGen.IOperationFilter that adds 401/403 response codes and an OAuth2 security requirement to every Swagger/OpenAPI operation decorated with Authorization.AuthorizeAttribute. ##### `AuthorizeCheckOperationFilter()` ##### `Apply(OpenApiOperation operation, OperationFilterContext context) : Void` Applies the filter to the given operation by checking whether the controller or action method is decorated with Authorization.AuthorizeAttribute. If so, 401 and 403 responses are added and an OAuth2 security requirement is attached. - `operation`: The OpenAPI operation being processed. - `context`: The filter context containing method and controller metadata. --- ## RCommon.Azure.Blobs ### Namespace RCommon.Azure.Blobs #### class AzureBlobStorageBuilder Concrete builder that registers Azure Blob Storage services into the DI container. Constructor accepts RCommon.IRCommonBuilder (required by Activator.CreateInstance pattern). ##### `AzureBlobStorageBuilder(IRCommonBuilder builder)` ##### `AddBlobStore(String name, Action options) : IAzureBlobStorageBuilder` ##### `Services : IServiceCollection` #### class AzureBlobStorageService Azure Blob Storage implementation of Blobs.IBlobStorageService. Wraps Blobs.BlobServiceClient from the Azure.Storage.Blobs SDK. ##### `AzureBlobStorageService(BlobServiceClient client)` ##### `ContainerExistsAsync(String containerName, CancellationToken token) : Task` ##### `CopyAsync(String sourceContainer, String sourceBlob, String destContainer, String destBlob, CancellationToken token) : Task` ##### `CreateContainerAsync(String containerName, CancellationToken token) : Task` ##### `DeleteAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `DeleteContainerAsync(String containerName, CancellationToken token) : Task` ##### `DownloadAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `ExistsAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `GetPresignedDownloadUrlAsync(String containerName, String blobName, TimeSpan expiry, CancellationToken token) : Task` ##### `GetPresignedUploadUrlAsync(String containerName, String blobName, TimeSpan expiry, CancellationToken token) : Task` ##### `GetPropertiesAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `ListBlobsAsync(String containerName, String prefix, CancellationToken token) : Task>` ##### `ListContainersAsync(CancellationToken token) : Task>` ##### `MoveAsync(String sourceContainer, String sourceBlob, String destContainer, String destBlob, CancellationToken token) : Task` ##### `SetMetadataAsync(String containerName, String blobName, IDictionary metadata, CancellationToken token) : Task` ##### `UploadAsync(String containerName, String blobName, Stream content, BlobUploadOptions options, CancellationToken token) : Task` #### class AzureBlobStoreOptions Configuration options for a named Azure Blob Storage store. Provide either AzureBlobStoreOptions.ConnectionString or AzureBlobStoreOptions.ServiceUri + AzureBlobStoreOptions.Credential. ##### `AzureBlobStoreOptions()` ##### `ConnectionString : String` ##### `Credential : TokenCredential` ##### `ServiceUri : Uri` #### interface IAzureBlobStorageBuilder Builder interface for configuring Azure Blob Storage as an Blobs.IBlobStorageService provider. ##### `AddBlobStore(String name, Action options) : IAzureBlobStorageBuilder` --- ## RCommon.Blobs ### Namespace RCommon.Blobs #### class BlobItem Represents a blob item returned from listing operations. ##### `BlobItem()` ##### `ContentType : String` ##### `LastModified : Nullable` ##### `Metadata : IDictionary` ##### `Name : String` ##### `Size : Nullable` #### class BlobProperties Detailed properties of a blob, returned from GetPropertiesAsync. ##### `BlobProperties()` ##### `ContentLength : Int64` ##### `ContentType : String` ##### `ETag : String` ##### `LastModified : Nullable` ##### `Metadata : IDictionary` #### class BlobStorageBuilderExtensions Extension methods on RCommon.IRCommonBuilder for registering blob storage infrastructure. ##### `WithBlobStorage(IRCommonBuilder builder) : IRCommonBuilder` Registers a blob storage provider with default configuration. ##### `WithBlobStorage(IRCommonBuilder builder, Action actions) : IRCommonBuilder` #### class BlobStoreFactory Resolves named Blobs.IBlobStorageService instances by invoking registered factory delegates. Instances are created lazily on first resolution and cached for subsequent calls. ##### `BlobStoreFactory(IServiceProvider provider, IOptions options)` ##### `Resolve(String name) : IBlobStorageService` #### class BlobStoreFactoryOptions Configuration options for Blobs.BlobStoreFactory. Stores factory delegates keyed by blob store name. ##### `BlobStoreFactoryOptions()` ##### `Stores : ConcurrentDictionary>` #### class BlobStoreNotFoundException Thrown when a named blob store cannot be resolved from the factory. ##### `BlobStoreNotFoundException(String message)` #### class BlobUploadOptions Options for upload operations. ##### `BlobUploadOptions()` ##### `ContentType : String` ##### `Metadata : IDictionary` ##### `Overwrite : Boolean` #### interface IBlobStorageBuilder Base builder interface for configuring blob storage providers within the RCommon builder pipeline. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register blob storage dependencies. #### interface IBlobStorageService Provider-agnostic interface for blob/object storage operations. Covers container management, blob CRUD, metadata, transfer, and presigned URL generation. ##### `ContainerExistsAsync(String containerName, CancellationToken token) : Task` ##### `CopyAsync(String sourceContainer, String sourceBlob, String destContainer, String destBlob, CancellationToken token) : Task` ##### `CreateContainerAsync(String containerName, CancellationToken token) : Task` ##### `DeleteAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `DeleteContainerAsync(String containerName, CancellationToken token) : Task` ##### `DownloadAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `ExistsAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `GetPresignedDownloadUrlAsync(String containerName, String blobName, TimeSpan expiry, CancellationToken token) : Task` ##### `GetPresignedUploadUrlAsync(String containerName, String blobName, TimeSpan expiry, CancellationToken token) : Task` ##### `GetPropertiesAsync(String containerName, String blobName, CancellationToken token) : Task` ##### `ListBlobsAsync(String containerName, String prefix, CancellationToken token) : Task>` ##### `ListContainersAsync(CancellationToken token) : Task>` ##### `MoveAsync(String sourceContainer, String sourceBlob, String destContainer, String destBlob, CancellationToken token) : Task` ##### `SetMetadataAsync(String containerName, String blobName, IDictionary metadata, CancellationToken token) : Task` ##### `UploadAsync(String containerName, String blobName, Stream content, BlobUploadOptions options, CancellationToken token) : Task` #### interface IBlobStoreFactory Resolves named Blobs.IBlobStorageService instances from registered blob stores. ##### `Resolve(String name) : IBlobStorageService` Resolves a blob storage service by its registered name. --- ## RCommon.Caching ### Namespace RCommon.Caching #### class CacheKey Represents a strongly-typed cache key with built-in validation and factory methods. ##### `CacheKey(String value)` Initializes a new instance of the Caching.CacheKey class. - `value`: The cache key string value. - Throws: `System.ArgumentNullException` - Throws: `System.ArgumentOutOfRangeException` ##### `MaxLength : Int32` The maximum allowed length for a cache key value. ##### `With(String[] keys) : CacheKey` Creates a Caching.CacheKey by joining the specified key segments with a hyphen delimiter. - `keys`: The key segments to join. - Returns: A new Caching.CacheKey composed of the joined segments. ##### `With(Type ownerType, String[] keys) : CacheKey` Creates a Caching.CacheKey scoped to the specified owner type, using its cache key representation as a prefix followed by the joined key segments. - `ownerType`: The type used to scope the cache key. - `keys`: The key segments to join after the type prefix. - Returns: A new Caching.CacheKey in the format TypeCacheKey:segment1-segment2. #### class CachingBuilderExtensions Extension methods on RCommon.IRCommonBuilder for registering caching infrastructure. ##### `WithDistributedCaching(IRCommonBuilder builder) : IRCommonBuilder` Registers an Caching.IDistributedCachingBuilder implementation with default configuration. - `builder`: The RCommon builder instance. - Returns: The same RCommon.IRCommonBuilder for chaining. ##### `WithDistributedCaching(IRCommonBuilder builder, Action actions) : IRCommonBuilder` ##### `WithMemoryCaching(IRCommonBuilder builder) : IRCommonBuilder` Registers an Caching.IMemoryCachingBuilder implementation with default configuration. - `builder`: The RCommon builder instance. - Returns: The same RCommon.IRCommonBuilder for chaining. ##### `WithMemoryCaching(IRCommonBuilder builder, Action actions) : IRCommonBuilder` #### enum ExpressionCachingStrategy Defines the strategy used when caching dynamically compiled expressions and lambdas. ##### `Default : ExpressionCachingStrategy` The default expression caching strategy. ##### `value__ : Int32` #### interface ICacheService Provides a uniform interface for cache read-through (get-or-create) operations, regardless of the underlying caching provider. ##### `GetOrCreate(Object key, Func data) : TData` ##### `GetOrCreateAsync(Object key, Func data) : Task` #### interface IDistributedCachingBuilder Defines the contract for configuring distributed caching services within the RCommon builder pipeline. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register distributed caching dependencies. #### interface IMemoryCachingBuilder Defines the contract for configuring in-memory caching services within the RCommon builder pipeline. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register memory caching dependencies. --- ## RCommon.Dapper ### Namespace RCommon #### class DapperPersistenceBuilder Implementation of RCommon.IDapperBuilder that configures Dapper-based persistence services in the dependency injection container. ##### `DapperPersistenceBuilder(IServiceCollection services)` Initializes a new instance of RCommon.DapperPersistenceBuilder and registers Dapper repository services in the provided service collection. - `services`: The DependencyInjection.IServiceCollection to register services with. - Throws: `System.ArgumentNullException` ##### `AddDbConnection(String dataStoreName, Action options) : IDapperBuilder` ##### `Services : IServiceCollection` ##### `SetDefaultDataStore(Action options) : IPersistenceBuilder` ##### `UseLockStatementProvider() : IDapperBuilder` Registers the lock statement provider used for outbox claiming operations. - Returns: The builder instance for fluent chaining. #### interface IDapperBuilder Defines the fluent builder interface for configuring Dapper-based persistence in RCommon. ##### `AddDbConnection(String dataStoreName, Action options) : IDapperBuilder` ### Namespace RCommon.Persistence.Dapper #### class DapperFluentMappingsException Exception thrown when Dapper fluent mapping configuration encounters an error. ##### `DapperFluentMappingsException(String message)` Initializes a new instance of Dapper.DapperFluentMappingsException with the specified error message. - `message`: A message describing the fluent mapping error. ### Namespace RCommon.Persistence.Dapper.Crud #### class DapperAggregateRepository A DDD-constrained repository for aggregate roots backed by Dapper and the Dommel extension library. Inherits SQL infrastructure from Crud.SqlRepositoryBase`1 and exposes the narrow Crud.IAggregateRepository`2 contract for aggregate-appropriate operations only. ##### `DapperAggregateRepository(IDataStoreFactory dataStoreFactory, ILoggerFactory logger, IEntityEventTracker eventTracker, IOptions defaultDataStoreOptions, ITenantIdAccessor tenantIdAccessor)` ##### `AddAsync(TAggregate entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteAsync(TAggregate entity, CancellationToken token) : Task` Deletes the aggregate. If TAggregate implements Entities.ISoftDelete, a soft delete is performed automatically (sets IsDeleted = true and issues an UPDATE). Otherwise a physical DELETE is executed. ##### `DeleteAsync(TAggregate entity, Boolean isSoftDelete, CancellationToken token) : Task` Deletes the aggregate using the explicitly specified delete mode. When isSoftDelete is true, the aggregate must implement Entities.ISoftDelete; its IsDeleted property is set to true and an UPDATE is issued. When false, a physical DELETE is always performed — even if the aggregate implements Entities.ISoftDelete. - Throws: `System.InvalidOperationException` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `UpdateAsync(TAggregate entity, CancellationToken token) : Task` #### class DapperReadModelRepository A read-model repository implementation using Dapper and the Dommel extension library for query operations. ##### `DapperReadModelRepository(IDataStoreFactory dataStoreFactory, ILoggerFactory loggerFactory, IOptions defaultDataStoreOptions)` ##### `AnyAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `DataStoreName : String` ##### `FindAllAsync(ISpecification specification, CancellationToken cancellationToken) : Task>` ##### `FindAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `GetCountAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `GetPagedAsync(IPagedSpecification specification, CancellationToken cancellationToken) : Task>` ##### `Include(Expression> path) : IReadModelRepository` #### class DapperRepository A concrete repository implementation using Dapper and the Dommel extension library for CRUD operations. ##### `DapperRepository(IDataStoreFactory dataStoreFactory, ILoggerFactory logger, IEntityEventTracker eventTracker, IOptions defaultDataStoreOptions, ITenantIdAccessor tenantIdAccessor)` ##### `AddAsync(TEntity entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteAsync(TEntity entity, CancellationToken token) : Task` Deletes the entity. If TEntity implements Entities.ISoftDelete, a soft delete is performed automatically (sets IsDeleted = true and issues an UPDATE). Otherwise a physical DELETE is executed. ##### `DeleteAsync(TEntity entity, Boolean isSoftDelete, CancellationToken token) : Task` Deletes the entity using the explicitly specified delete mode. When isSoftDelete is true, the entity must implement Entities.ISoftDelete; its IsDeleted property is set to true and an UPDATE is issued. When false, a physical DELETE is always performed — even if the entity implements Entities.ISoftDelete. - Throws: `System.InvalidOperationException` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `UpdateAsync(TEntity entity, CancellationToken token) : Task` ### Namespace RCommon.Persistence.Dapper.Inbox #### class DapperInboxStore ##### `DapperInboxStore(IDataStoreFactory dataStoreFactory, IOptions defaultDataStoreOptions, IOptions outboxOptions)` ##### `CleanupAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `ExistsAsync(Guid messageId, String consumerType, CancellationToken cancellationToken) : Task` ##### `RecordAsync(IInboxMessage message, CancellationToken cancellationToken) : Task` ### Namespace RCommon.Persistence.Dapper.Outbox #### class DapperOutboxStore ##### `DapperOutboxStore(IDataStoreFactory dataStoreFactory, IOptions defaultDataStoreOptions, IOptions outboxOptions, ILockStatementProvider lockStatementProvider)` ##### `ClaimAsync(String instanceId, Int32 batchSize, TimeSpan lockDuration, CancellationToken cancellationToken) : Task>` ##### `DeleteDeadLetteredAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `DeleteProcessedAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `GetDeadLettersAsync(Int32 batchSize, Int32 offset, CancellationToken cancellationToken) : Task>` ##### `MarkDeadLetteredAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `MarkFailedAsync(Guid messageId, String error, DateTimeOffset nextRetryAtUtc, CancellationToken cancellationToken) : Task` ##### `MarkProcessedAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `ReplayDeadLetterAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `SaveAsync(IOutboxMessage message, CancellationToken cancellationToken) : Task` ### Namespace RCommon.Persistence.Dapper.Sagas #### class DapperSagaStore A Dapper/Dommel implementation of Sagas.ISagaStore`2 that persists saga state using a Sql.RDbConnection resolved through the Persistence.IDataStoreFactory. ##### `DapperSagaStore(IDataStoreFactory dataStoreFactory, ILoggerFactory loggerFactory, IOptions defaultDataStoreOptions)` ##### `DeleteAsync(TState state, CancellationToken ct) : Task` ##### `FindByCorrelationIdAsync(String correlationId, CancellationToken ct) : Task` ##### `GetByIdAsync(TKey id, CancellationToken ct) : Task` ##### `SaveAsync(TState state, CancellationToken ct) : Task` --- ## RCommon.EFCore ### Namespace RCommon #### class EFCorePerisistenceBuilder Obsolete, misspelled alias for RCommon.EFCorePersistenceBuilder, kept as a thin forwarding subclass so existing consumer code (e.g. WithPersistence(...)) keeps compiling. New code should reference RCommon.EFCorePersistenceBuilder directly. ##### `EFCorePerisistenceBuilder(IServiceCollection services)` Initializes a new instance of RCommon.EFCorePerisistenceBuilder. - `services`: The DependencyInjection.IServiceCollection to register services with. #### class EFCorePersistenceBuilder Implementation of RCommon.IEFCorePersistenceBuilder that configures Entity Framework Core persistence services in the dependency injection container. ##### `EFCorePersistenceBuilder(IServiceCollection services)` Initializes a new instance of RCommon.EFCorePersistenceBuilder and registers EF Core repository services in the provided service collection. - `services`: The DependencyInjection.IServiceCollection to register services with. - Throws: `System.ArgumentNullException` ##### `AddDbContext(String dataStoreName, Action options) : IEFCorePersistenceBuilder` ##### `Services : IServiceCollection` ##### `SetDefaultDataStore(Action options) : IPersistenceBuilder` #### interface IEFCorePersistenceBuilder Defines the fluent builder interface for configuring Entity Framework Core persistence in RCommon. ##### `AddDbContext(String dataStoreName, Action options) : IEFCorePersistenceBuilder` ### Namespace RCommon.Persistence.EFCore #### class RCommonDbContext Abstract base class for all EF Core DbContexts used within the RCommon persistence layer. ##### `RCommonDbContext(DbContextOptions options)` Initializes a new instance of EFCore.RCommonDbContext with the specified options. - `options`: The EntityFrameworkCore.DbContextOptions used to configure this context. - Throws: `System.ArgumentNullException` ##### `GetDbConnection() : DbConnection` Gets the underlying Common.DbConnection for this context. - Returns: The Common.DbConnection associated with the current database. ### Namespace RCommon.Persistence.EFCore.Crud #### class EFCoreAggregateRepository A DDD-constrained repository for aggregate roots backed by Entity Framework Core. Inherits full LINQ/graph repository infrastructure from Crud.GraphRepositoryBase`1 and exposes the narrow Crud.IAggregateRepository`2 contract for aggregate-appropriate operations only. ##### `EFCoreAggregateRepository(IDataStoreFactory dataStoreFactory, ILoggerFactory logger, IEntityEventTracker eventTracker, IOptions defaultDataStoreOptions, ITenantIdAccessor tenantIdAccessor)` ##### `AddAsync(TAggregate entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteAsync(TAggregate entity, CancellationToken token) : Task` Deletes the entity. If TAggregate implements Entities.ISoftDelete, a soft delete is performed automatically (sets IsDeleted = true and issues an UPDATE). Otherwise a physical DELETE is executed. ##### `DeleteAsync(TAggregate entity, Boolean isSoftDelete, CancellationToken token) : Task` Deletes the entity using the explicitly specified delete mode. When isSoftDelete is true, the entity must implement Entities.ISoftDelete; its IsDeleted property is set to true and an UPDATE is issued. When false, a physical DELETE is always performed — even if the entity implements Entities.ISoftDelete. - Throws: `System.InvalidOperationException` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindQuery(ISpecification specification) : IQueryable` ##### `FindQuery(Expression> expression) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending) : IQueryable` ##### `FindQuery(IPagedSpecification specification) : IQueryable` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `Include(Expression> path) : IEagerLoadableQueryable` ##### `ThenInclude(Expression> path) : IEagerLoadableQueryable` ##### `Tracking : Boolean` Gets or sets whether EF Core change tracking is enabled for queries executed through this repository. ##### `UpdateAsync(TAggregate entity, CancellationToken token) : Task` #### class EFCoreReadModelRepository ##### `EFCoreReadModelRepository(IDataStoreFactory dataStoreFactory, ILoggerFactory loggerFactory, IOptions defaultDataStoreOptions)` ##### `AnyAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `DataStoreName : String` ##### `FindAllAsync(ISpecification specification, CancellationToken cancellationToken) : Task>` ##### `FindAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `GetCountAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `GetPagedAsync(IPagedSpecification specification, CancellationToken cancellationToken) : Task>` ##### `Include(Expression> path) : IReadModelRepository` #### class EFCoreRepository A concrete repository implementation for Entity Framework Core that supports CRUD operations, LINQ queries, eager loading, and graph-based entity navigation. ##### `EFCoreRepository(IDataStoreFactory dataStoreFactory, ILoggerFactory logger, IEntityEventTracker eventTracker, IOptions defaultDataStoreOptions, ITenantIdAccessor tenantIdAccessor)` ##### `AddAsync(TEntity entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteAsync(TEntity entity, CancellationToken token) : Task` Deletes the entity. If TEntity implements Entities.ISoftDelete, a soft delete is performed automatically (sets IsDeleted = true and issues an UPDATE). Otherwise a physical DELETE is executed. ##### `DeleteAsync(TEntity entity, Boolean isSoftDelete, CancellationToken token) : Task` Deletes the entity using the explicitly specified delete mode. When isSoftDelete is true, the entity must implement Entities.ISoftDelete; its IsDeleted property is set to true and an UPDATE is issued. When false, a physical DELETE is always performed — even if the entity implements Entities.ISoftDelete. - Throws: `System.InvalidOperationException` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindQuery(ISpecification specification) : IQueryable` ##### `FindQuery(Expression> expression) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending) : IQueryable` ##### `FindQuery(IPagedSpecification specification) : IQueryable` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `Include(Expression> path) : IEagerLoadableQueryable` ##### `ThenInclude(Expression> path) : IEagerLoadableQueryable` ##### `Tracking : Boolean` Gets or sets whether EF Core change tracking is enabled for queries executed through this repository. ##### `UpdateAsync(TEntity entity, CancellationToken token) : Task` ### Namespace RCommon.Persistence.EFCore.Inbox #### class EFCoreInboxStore ##### `EFCoreInboxStore(IDataStoreFactory dataStoreFactory, IOptions defaultDataStoreOptions, IOptions outboxOptions)` ##### `CleanupAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `ExistsAsync(Guid messageId, String consumerType, CancellationToken cancellationToken) : Task` ##### `RecordAsync(IInboxMessage message, CancellationToken cancellationToken) : Task` #### class InboxMessageConfiguration ##### `InboxMessageConfiguration(String tableName)` ##### `Configure(EntityTypeBuilder builder) : Void` ### Namespace RCommon.Persistence.EFCore.Outbox #### class EFCoreOutboxStore An EF Core implementation of Outbox.IOutboxStore that persists outbox messages using a EFCore.RCommonDbContext resolved through the Persistence.IDataStoreFactory. ##### `EFCoreOutboxStore(IDataStoreFactory dataStoreFactory, IOptions defaultDataStoreOptions, IOptions outboxOptions)` ##### `ClaimAsync(String instanceId, Int32 batchSize, TimeSpan lockDuration, CancellationToken cancellationToken) : Task>` ##### `DeleteDeadLetteredAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `DeleteProcessedAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `GetDeadLettersAsync(Int32 batchSize, Int32 offset, CancellationToken cancellationToken) : Task>` ##### `MarkDeadLetteredAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `MarkFailedAsync(Guid messageId, String error, DateTimeOffset nextRetryAtUtc, CancellationToken cancellationToken) : Task` ##### `MarkProcessedAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `ReplayDeadLetterAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `SaveAsync(IOutboxMessage message, CancellationToken cancellationToken) : Task` #### class ModelBuilderExtensions ##### `AddInboxMessages(ModelBuilder modelBuilder, String tableName) : ModelBuilder` ##### `AddOutboxMessages(ModelBuilder modelBuilder, String tableName) : ModelBuilder` #### class OutboxMessageConfiguration ##### `OutboxMessageConfiguration(String tableName)` ##### `Configure(EntityTypeBuilder builder) : Void` ### Namespace RCommon.Persistence.EFCore.Sagas #### class EFCoreSagaStore An EF Core implementation of Sagas.ISagaStore`2 that persists saga state using a EFCore.RCommonDbContext resolved through the Persistence.IDataStoreFactory. ##### `EFCoreSagaStore(IDataStoreFactory dataStoreFactory, ILoggerFactory loggerFactory, IOptions defaultDataStoreOptions)` ##### `DeleteAsync(TState state, CancellationToken ct) : Task` ##### `FindByCorrelationIdAsync(String correlationId, CancellationToken ct) : Task` ##### `GetByIdAsync(TKey id, CancellationToken ct) : Task` ##### `SaveAsync(TState state, CancellationToken ct) : Task` --- ## RCommon.Emailing ### Namespace RCommon #### class EmailingBuilderExtensions Extension methods for RCommon.IRCommonBuilder that register SMTP-based email services. ##### `WithSmtpEmailServices(IRCommonBuilder config, Action emailSettings) : IRCommonBuilder` ### Namespace RCommon.Emailing #### class EmailEventArgs Event arguments for email-related events, carrying the Mail.MailMessage that was sent. ##### `EmailEventArgs(MailMessage mailMessage)` Initializes a new instance of the Emailing.EmailEventArgs class. - `mailMessage`: The mail message associated with this event. ##### `MailMessage : MailMessage` Gets the Mail.MailMessage associated with this event. #### interface IEmailService Defines a service for sending email messages, with support for both synchronous and asynchronous delivery. ##### `EmailSent : EventHandler` Occurs after an email has been successfully sent. ##### `SendEmail(MailMessage message) : Void` Sends the specified message synchronously. - `message`: The Mail.MailMessage to send. ##### `SendEmailAsync(MailMessage message, CancellationToken cancellationToken) : Task` Sends the specified message asynchronously. - `message`: The Mail.MailMessage to send. - `cancellationToken`: Optional cancellation token. - Returns: A Tasks.Task representing the asynchronous send operation. ### Namespace RCommon.Emailing.Smtp #### class SmtpEmailService Implementation of Emailing.IEmailService that sends email using the built-in Mail.SmtpClient. ##### `SmtpEmailService(IOptions settings)` ##### `EmailSent : EventHandler` Occurs after an e-mail has been sent. The sender is the MailMessage object. ##### `SendEmail(MailMessage message) : Void` Sends a MailMessage object using the SMTP settings. ##### `SendEmailAsync(MailMessage message, CancellationToken cancellationToken) : Task` Sends the mail message asynchronously in another thread. - `message`: The message to send. #### class SmtpEmailSettings Configuration settings for the Smtp.SmtpEmailService. Typically bound from an application configuration section (e.g., appsettings.json). ##### `SmtpEmailSettings()` Initializes a new instance of the Smtp.SmtpEmailSettings class. ##### `EnableSsl : Boolean` Gets or sets a value indicating whether SSL is enabled for the SMTP connection. ##### `FromEmailDefault : String` Gets or sets the default sender email address used when no explicit "From" address is specified. ##### `FromNameDefault : String` Gets or sets the default sender display name used when no explicit "From" name is specified. ##### `Host : String` Gets or sets the SMTP server host name or IP address. ##### `Password : String` Gets or sets the SMTP authentication password. ##### `Port : Int32` Gets or sets the SMTP server port number. ##### `UserName : String` Gets or sets the SMTP authentication user name. --- ## RCommon.Entities ### Namespace RCommon.Entities #### class AggregateRoot Abstract base class for aggregate roots. Extends BusinessEntity to reuse event tracking, key support, and entity equality. Adds versioning for optimistic concurrency and typed domain event methods. ##### `ClearDomainEvents() : Void` Clears all pending domain events from this aggregate. ##### `DomainEvents : IReadOnlyCollection` Returns the domain events that have been raised by this aggregate but not yet dispatched. ##### `Version : Int32` Version number for optimistic concurrency control. Incremented via AggregateRoot`1.IncrementVersion. Decorated with [ConcurrencyCheck] to signal ORM-level concurrency checking. #### class AuditedEntity Abstract base class for entities that track creation and modification audit information. Uses Entities.BusinessEntity as the base (no explicit primary key type). ##### `CreatedBy : TCreatedByUser` ##### `DateCreated : Nullable` ##### `DateLastModified : Nullable` ##### `LastModifiedBy : TLastModifiedByUser` #### class AuditedEntity Abstract base class for entities that track creation and modification audit information with an explicit strongly-typed primary key. ##### `CreatedBy : TCreatedByUser` ##### `DateCreated : Nullable` ##### `DateLastModified : Nullable` ##### `LastModifiedBy : TLastModifiedByUser` #### class BusinessEntity ##### `BusinessEntity()` Initializes a new instance of Entities.BusinessEntity. ##### `AddLocalEvent(ISerializableEvent eventItem) : Void` ##### `AllowEventTracking : Boolean` ##### `ClearLocalEvents() : Void` ##### `EntityEquals(IBusinessEntity other) : Boolean` ##### `GetKeys() : Object[]` ##### `LocalEvents : IReadOnlyCollection` ##### `RemoveLocalEvent(ISerializableEvent eventItem) : Void` ##### `ToString() : String` ##### `TransactionalEventAdded : EventHandler` Occurs when a transactional event is added to this entity. ##### `TransactionalEventRemoved : EventHandler` Occurs when a transactional event is removed from this entity. ##### `TransactionalEventsCleared : EventHandler` Occurs when all transactional events are cleared from this entity. #### class BusinessEntity ##### `GetKeys() : Object[]` ##### `Id : TKey` ##### `ToString() : String` #### class DomainEntity Abstract base class for domain entities within an aggregate. Provides identity-based equality but no event tracking — entities within an aggregate raise events through their aggregate root. Because DomainEntity does not implement IBusinessEntity, the ObjectGraphWalker in InMemoryEntityEventTracker will not traverse it. All domain events must be raised on the aggregate root. ##### `Equals(DomainEntity other) : Boolean` ##### `Equals(Object obj) : Boolean` ##### `GetHashCode() : Int32` ##### `Id : TKey` The unique identity of this entity. ##### `IsTransient() : Boolean` Returns true if this entity has not yet been assigned a persistent identity. #### class DomainEvent Abstract base record for domain events. Provides default values for EventId and OccurredOn. Use as a base for all concrete domain events. ##### `$() : DomainEvent` ##### `Equals(Object obj) : Boolean` ##### `Equals(DomainEvent other) : Boolean` ##### `EventId : Guid` ##### `GetHashCode() : Int32` ##### `OccurredOn : DateTimeOffset` ##### `ToString() : String` #### class EntityNotFoundException Exception thrown when an entity expected to be found does not exist. ##### `EntityNotFoundException()` Creates a new Entities.EntityNotFoundException object. ##### `EntityNotFoundException(Type entityType)` Creates a new Entities.EntityNotFoundException object. - `entityType`: The type of the entity that was not found. ##### `EntityNotFoundException(Type entityType, Object id)` Creates a new Entities.EntityNotFoundException object. - `entityType`: The type of the entity that was not found. - `id`: The identifier of the entity that was not found. ##### `EntityNotFoundException(Type entityType, Object id, Exception innerException)` Creates a new Entities.EntityNotFoundException object with an auto-generated message. - `entityType`: The type of the entity that was not found. - `id`: The identifier of the entity that was not found, or null if unknown. - `innerException`: The inner exception, or null if none. ##### `EntityNotFoundException(String message)` Creates a new Entities.EntityNotFoundException object. - `message`: Exception message ##### `EntityNotFoundException(String message, Exception innerException)` Creates a new Entities.EntityNotFoundException object. - `message`: Exception message - `innerException`: Inner exception ##### `EntityType : Type` Type of the entity. ##### `Id : Object` Id of the Entity. #### interface IAggregateRoot Non-generic marker interface for aggregate roots. Useful for infrastructure scenarios such as repository filtering, middleware, and generic constraints. ##### `DomainEvents : IReadOnlyCollection` The collection of domain events raised by this aggregate that have not yet been dispatched. ##### `Version : Int32` The version number used for optimistic concurrency control. #### interface IAggregateRoot Generic interface for aggregate roots in the domain model. Extends IBusinessEntity to maintain compatibility with existing repository and event tracking infrastructure. Note: The IEquatable constraint is stricter than IBusinessEntity — this is intentional because aggregate roots require identity equality for consistency guarantees. #### interface IAuditedEntity Defines the contract for an entity that captures audit information including who created and last modified it, and when. ##### `CreatedBy : TCreatedByUser` Gets or sets the user who created this entity. ##### `DateCreated : Nullable` Gets or sets the date and time when this entity was created. ##### `DateLastModified : Nullable` Gets or sets the date and time when this entity was last modified. ##### `LastModifiedBy : TLastModifiedByUser` Gets or sets the user who last modified this entity. #### interface IAuditedEntity Extends Entities.IAuditedEntity`2 with a strongly-typed primary key. #### interface IBusinessEntity Defines an entity. It's primary key may not be "Id" or it may have a composite primary key. Use Entities.IBusinessEntity`1 where possible for better integration to repositories and other structures in the framework. ##### `AddLocalEvent(ISerializableEvent eventItem) : Void` Adds a transactional event to this entity's local event collection. - `eventItem`: The serializable event to add. ##### `ClearLocalEvents() : Void` Removes all transactional events from this entity's local event collection. ##### `EntityEquals(IBusinessEntity other) : Boolean` Determines whether this entity is equal to another Entities.IBusinessEntity using binary comparison. - `other`: The other entity to compare against. - Returns: true if the entities are equal; otherwise, false. ##### `GetKeys() : Object[]` Returns an array of ordered keys for this entity. - Returns: An object array containing the entity's key values in order. ##### `LocalEvents : IReadOnlyCollection` Gets the read-only collection of local (transactional) events accumulated on this entity. ##### `RemoveLocalEvent(ISerializableEvent eventItem) : Void` Removes a specific transactional event from this entity's local event collection. - `eventItem`: The serializable event to remove. #### interface IBusinessEntity Defines an entity with a single primary key with "Id" property. ##### `Id : TKey` Unique identifier for this entity. #### interface IDomainEvent Represents a domain event raised by an aggregate root. Extends ISerializableEvent for compatibility with the existing event routing pipeline. ##### `EventId : Guid` Unique identifier for this event instance. ##### `OccurredOn : DateTimeOffset` The date and time when this event occurred. #### interface IEntityEventTracker Defines a mechanism for tracking entities and emitting their transactional (local) events through the event routing infrastructure. ##### `AddEntity(IBusinessEntity entity) : Void` Adds an entity that can be tracked for any new events associated with it. - `entity`: The business entity to track for transactional events. ##### `EmitTransactionalEventsAsync(CancellationToken cancellationToken) : Task` Publishes the events associated with each entity being tracked. - `cancellationToken`: A token to observe for cancellation requests. - Returns: True if successful ##### `PersistEventsAsync(CancellationToken cancellationToken) : Task` Persists domain events to the outbox (or equivalent durable store) within the active transaction, before the transaction is committed. The in-memory implementation is a no-op. - `cancellationToken`: A token to observe for cancellation requests. ##### `TrackedEntities : ICollection` The collection of entities that each may store a collection of events. #### interface IMultiTenant Marks an entity as belonging to a specific tenant. When multitenancy is configured, the repository will automatically set IMultiTenant.TenantId on add operations and filter read operations to only return entities matching the current tenant. ##### `TenantId : String` Gets or sets the identifier of the tenant that owns this entity. When null, the entity is not associated with any tenant. #### interface ISoftDelete Marks an entity as capable of being soft-deleted. When soft delete is requested, the repository will set ISoftDelete.IsDeleted to true instead of physically removing the record from the data store. ##### `IsDeleted : Boolean` Gets or sets a value indicating whether this entity has been soft-deleted. When true, the entity is considered deleted but remains in the data store. #### interface ITrackedEntity Marks an entity as capable of participating in event tracking. When ITrackedEntity.AllowEventTracking is true, the entity's local events can be collected and emitted by an Entities.IEntityEventTracker. ##### `AllowEventTracking : Boolean` Gets or sets a value indicating whether this entity should have its events tracked. #### class InMemoryEntityEventTracker In-memory implementation of Entities.IEntityEventTracker that collects entities and emits their transactional events through an Producers.IEventRouter. ##### `InMemoryEntityEventTracker(IEventRouter eventRouter)` Initializes a new instance of Entities.InMemoryEntityEventTracker. - `eventRouter`: The event router used to dispatch collected transactional events. - Throws: `System.ArgumentNullException` ##### `AddEntity(IBusinessEntity entity) : Void` ##### `EmitTransactionalEventsAsync(CancellationToken cancellationToken) : Task` ##### `PersistEventsAsync(CancellationToken cancellationToken) : Task` ##### `TrackedEntities : ICollection` #### class TransactionalEventsChangedEventArgs Provides data for events raised when a transactional (local) event is added to or removed from a Entities.IBusinessEntity. ##### `TransactionalEventsChangedEventArgs(IBusinessEntity entity, ISerializableEvent eventData)` Initializes a new instance of Entities.TransactionalEventsChangedEventArgs. - `entity`: The entity on which the transactional event changed. - `eventData`: The serializable event that was added or removed. ##### `Entity : IBusinessEntity` Gets the entity on which the transactional event changed. ##### `EventData : ISerializableEvent` Gets the serializable event that was added or removed. #### class TransactionalEventsClearedEventArgs Provides data for the event raised when all transactional (local) events are cleared from a Entities.IBusinessEntity. ##### `TransactionalEventsClearedEventArgs(IBusinessEntity entity)` Initializes a new instance of Entities.TransactionalEventsClearedEventArgs. - `entity`: The entity whose transactional events were cleared. ##### `Entity : IBusinessEntity` Gets the entity whose transactional events were cleared. #### class ValueObject Abstract base record for value objects. Leverages C# record semantics for automatic structural equality, immutability, and with-expression support. Derive concrete value objects from this type: public record Money(decimal Amount, string Currency) : ValueObject; public record Address(string Street, string City, string ZipCode) : ValueObject; ##### `$() : ValueObject` ##### `Equals(Object obj) : Boolean` ##### `Equals(ValueObject other) : Boolean` ##### `GetHashCode() : Int32` ##### `ToString() : String` #### class ValueObject Abstract base record for single-value wrapper value objects. Provides a typed ValueObject`1.Value property and implicit conversions to/from T. ##### `$() : ValueObject` ##### `Deconstruct(T& Value) : Void` ##### `Equals(Object obj) : Boolean` ##### `Equals(ValueObject other) : Boolean` ##### `Equals(ValueObject other) : Boolean` ##### `GetHashCode() : Int32` ##### `ToString() : String` ##### `Value : T` --- ## RCommon.Finbuckle ### Namespace RCommon.Finbuckle #### class FinbuckleMultiTenantBuilder Configures Finbuckle-based multitenancy for RCommon. Registers Finbuckle.FinbuckleTenantIdAccessor`1 as the Claims.ITenantIdAccessor implementation, replacing the default Claims.NullTenantIdAccessor. ##### `FinbuckleMultiTenantBuilder(IServiceCollection services)` Initializes a new instance of Finbuckle.FinbuckleMultiTenantBuilder`1. - `services`: The service collection for registering multitenancy services. ##### `Services : IServiceCollection` #### class FinbuckleTenantIdAccessor Adapts Finbuckle's Abstractions.IMultiTenantContextAccessor`1 to RCommon's Claims.ITenantIdAccessor interface, bridging the tenant resolution mechanism. ##### `FinbuckleTenantIdAccessor(IMultiTenantContextAccessor contextAccessor)` ##### `GetTenantId() : String` #### interface IFinbuckleMultiTenantBuilder Builder interface for configuring Finbuckle-based multitenancy within the RCommon framework. --- ## RCommon.FluentValidation ### Namespace RCommon.ApplicationServices #### class FluentValidationBuilderExtensions Provides extension methods on FluentValidation.IFluentValidationBuilder for registering FluentValidation validators into the DI container. ##### `AddValidator(IFluentValidationBuilder builder) : Void` Registers a specific FluentValidation validator for the given type with a scoped lifetime. - `builder`: The FluentValidation builder instance. ##### `AddValidatorsFromAssemblies(IFluentValidationBuilder builder, IEnumerable assemblies, ServiceLifetime lifetime, Func filter, Boolean includeInternalTypes) : Void` ##### `AddValidatorsFromAssembly(IFluentValidationBuilder builder, Assembly assembly, ServiceLifetime lifetime, Func filter, Boolean includeInternalTypes) : Void` ##### `AddValidatorsFromAssemblyContaining(IFluentValidationBuilder builder, Type type, ServiceLifetime lifetime, Func filter, Boolean includeInternalTypes) : Void` #### class ValidationBuilderExtensions Provides extension methods on RCommon.IRCommonBuilder for registering validation into the RCommon configuration pipeline. ##### `WithValidation(IRCommonBuilder builder, Action actions) : IRCommonBuilder` ### Namespace RCommon.FluentValidation #### class FluentValidationBuilder Default implementation of FluentValidation.IFluentValidationBuilder that registers the FluentValidation.FluentValidationProvider as the Validation.IValidationProvider in the DI container. ##### `FluentValidationBuilder(IRCommonBuilder builder)` Initializes a new instance of FluentValidation.FluentValidationBuilder and registers FluentValidation services into the DI container. - `builder`: The RCommon builder providing access to the DependencyInjection.IServiceCollection. ##### `Services : IServiceCollection` #### class FluentValidationProvider Implements Validation.IValidationProvider using the FluentValidation library. Resolves registered FluentValidation.IValidator`1 instances from the DI container and executes them against the target object. ##### `FluentValidationProvider(ILogger logger, IServiceProvider serviceProvider)` ##### `ValidateAsync(T target, Boolean throwOnFaults, CancellationToken cancellationToken) : Task` Validates the specified target object by resolving and executing all registered FluentValidation.IValidator`1 instances for the target's type. - `target`: The object to validate. - `throwOnFaults`: When , a Validation.ValidationException is thrown if any validation failures are found. - `cancellationToken`: A token to cancel the async operation. - Returns: A Validation.ValidationOutcome containing any validation faults. - Throws: `RCommon.ApplicationServices.Validation.ValidationException` #### interface IFluentValidationBuilder Builder interface for configuring validation using the FluentValidation library within the RCommon framework. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register FluentValidation services and validators. --- ## RCommon.Json ### Namespace RCommon.Json #### interface IJsonBuilder Defines the contract for configuring JSON serialization within the RCommon framework. Implementations register a specific JSON serialization library (e.g., Newtonsoft.Json or System.Text.Json) into the dependency injection container. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register JSON serialization services. #### interface IJsonSerializer Provides an abstraction for JSON serialization and deserialization operations. Implementations wrap a specific JSON library (e.g., Newtonsoft.Json or System.Text.Json). ##### `Deserialize(String json, JsonDeserializeOptions options) : T` Deserializes a JSON string to an object of type T. - `json`: The JSON string to deserialize. - `options`: Optional deserialization options such as camel casing. - Returns: The deserialized object of type T, or null if the JSON represents a null value. ##### `Deserialize(String json, Type type, JsonDeserializeOptions options) : Object` Deserializes a JSON string to an object of the specified type. - `json`: The JSON string to deserialize. - `type`: The System.Type to deserialize the JSON into. - `options`: Optional deserialization options such as camel casing. - Returns: The deserialized object, or null if the JSON represents a null value. ##### `Serialize(Object obj, JsonSerializeOptions options) : String` Serializes the specified object to a JSON string. - `obj`: The object to serialize. - `options`: Optional serialization options such as camel casing and indentation. - Returns: A JSON string representation of the object. ##### `Serialize(Object obj, Type type, JsonSerializeOptions options) : String` Serializes the specified object to a JSON string using the provided type information. - `obj`: The object to serialize. - `type`: The System.Type to use during serialization, which may differ from the runtime type. - `options`: Optional serialization options such as camel casing and indentation. - Returns: A JSON string representation of the object. #### class JsonBuilderExtensions Provides extension methods on RCommon.IRCommonBuilder for registering JSON serialization into the RCommon configuration pipeline. ##### `WithJsonSerialization(IRCommonBuilder builder) : IRCommonBuilder` Registers JSON serialization using the specified T builder with default options. - `builder`: The RCommon builder instance. - Returns: The RCommon.IRCommonBuilder for further chaining. ##### `WithJsonSerialization(IRCommonBuilder builder, Action serializeOptions, Action deSerializeOptions) : IRCommonBuilder` ##### `WithJsonSerialization(IRCommonBuilder builder, Action serializeOptions) : IRCommonBuilder` ##### `WithJsonSerialization(IRCommonBuilder builder, Action deSerializeOptions) : IRCommonBuilder` ##### `WithJsonSerialization(IRCommonBuilder builder, Action actions) : IRCommonBuilder` ##### `WithJsonSerialization(IRCommonBuilder builder, Action serializeOptions, Action deSerializeOptions, Action actions) : IRCommonBuilder` #### class JsonDeserializeOptions Configuration options applied during JSON deserialization. ##### `JsonDeserializeOptions()` Initializes a new instance of Json.JsonDeserializeOptions with default values. JsonDeserializeOptions.CamelCase defaults to . ##### `CamelCase : Boolean` Gets or sets a value indicating whether property names should use camelCase naming policy during deserialization. Defaults to . #### class JsonSerializeOptions Configuration options applied during JSON serialization. ##### `JsonSerializeOptions()` Initializes a new instance of Json.JsonSerializeOptions with default values. JsonSerializeOptions.CamelCase defaults to and JsonSerializeOptions.Indented defaults to . ##### `CamelCase : Boolean` Gets or sets a value indicating whether property names should use camelCase naming policy during serialization. Defaults to . ##### `Indented : Boolean` Gets or sets a value indicating whether the serialized JSON output should be indented for readability. Defaults to . --- ## RCommon.JsonNet ### Namespace RCommon.JsonNet #### interface IJsonNetBuilder Builder interface for configuring JSON serialization using the Newtonsoft.Json (Json.NET) library. #### class IJsonNetBuilderExtensions Provides extension methods for JsonNet.IJsonNetBuilder to configure Newtonsoft.Json settings. ##### `Configure(IJsonNetBuilder builder, Action options) : IJsonNetBuilder` #### class JsonNetBuilder Default implementation of JsonNet.IJsonNetBuilder that registers the Newtonsoft.Json-based JsonNet.JsonNetSerializer into the DI container. ##### `JsonNetBuilder(IRCommonBuilder builder)` Initializes a new instance of JsonNet.JsonNetBuilder and registers JSON serialization services. - `builder`: The RCommon builder providing access to the DependencyInjection.IServiceCollection. ##### `Services : IServiceCollection` #### class JsonNetSerializer Implements Json.IJsonSerializer using the Newtonsoft.Json (Json.NET) library. Supports per-call overrides for camel-case naming and indented formatting through Json.JsonSerializeOptions and Json.JsonDeserializeOptions. ##### `JsonNetSerializer(IOptions options)` ##### `Deserialize(String json, JsonDeserializeOptions options) : T` ##### `Deserialize(String json, Type type, JsonDeserializeOptions options) : Object` ##### `Serialize(Object obj, JsonSerializeOptions options) : String` ##### `Serialize(Object obj, Type type, JsonSerializeOptions options) : String` --- ## RCommon.Linq2Db ### Namespace RCommon.Persistence.Linq2Db #### interface ILinq2DbPersistenceBuilder Defines the fluent builder interface for configuring Linq2Db-based persistence in RCommon. ##### `AddDataConnection(String dataStoreName, Func options) : ILinq2DbPersistenceBuilder` ##### `UseLockStatementProvider() : ILinq2DbPersistenceBuilder` Registers a singleton ILockStatementProvider implementation used by Outbox.Linq2DbOutboxStore to select the correct SQL locking dialect for ClaimAsync. - Returns: The builder instance for fluent chaining. #### class Linq2DbPersistenceBuilder Implementation of Linq2Db.ILinq2DbPersistenceBuilder that configures Linq2Db-based persistence services in the dependency injection container. ##### `Linq2DbPersistenceBuilder(IServiceCollection services)` Initializes a new instance of Linq2Db.Linq2DbPersistenceBuilder and registers Linq2Db repository services in the provided service collection. - `services`: The DependencyInjection.IServiceCollection to register services with. - Throws: `System.ArgumentNullException` ##### `AddDataConnection(String dataStoreName, Func options) : ILinq2DbPersistenceBuilder` ##### `Services : IServiceCollection` ##### `SetDefaultDataStore(Action options) : IPersistenceBuilder` ##### `UseLockStatementProvider() : ILinq2DbPersistenceBuilder` #### class RCommonDataConnection Base data connection class for Linq2Db integration with the RCommon persistence layer. ##### `RCommonDataConnection(DataOptions linq2DbOptions)` Initializes a new instance of Linq2Db.RCommonDataConnection with the specified Linq2Db data options. - `linq2DbOptions`: The LinqToDB.DataOptions used to configure the Linq2Db connection. ##### `GetDbConnection() : DbConnection` Gets the underlying Common.DbConnection for this data connection. - Returns: The Common.DbConnection managed by the Linq2Db Data.DataConnection. ### Namespace RCommon.Persistence.Linq2Db.Crud #### class Linq2DbAggregateRepository A DDD-constrained repository for aggregate roots backed by Linq2Db. Inherits full LINQ repository infrastructure from Crud.LinqRepositoryBase`1 and exposes the narrow Crud.IAggregateRepository`2 contract for aggregate-appropriate operations only. ##### `Linq2DbAggregateRepository(IDataStoreFactory dataStoreFactory, ILoggerFactory logger, IEntityEventTracker eventTracker, IOptions defaultDataStoreOptions, ITenantIdAccessor tenantIdAccessor)` ##### `AddAsync(TAggregate entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteAsync(TAggregate entity, CancellationToken token) : Task` Deletes the aggregate. If TAggregate implements Entities.ISoftDelete, a soft delete is performed automatically (sets IsDeleted = true and issues an UPDATE). Otherwise a physical DELETE is executed. ##### `DeleteAsync(TAggregate entity, Boolean isSoftDelete, CancellationToken token) : Task` Deletes the aggregate using the explicitly specified delete mode. When isSoftDelete is true, the aggregate must implement Entities.ISoftDelete; its IsDeleted property is set to true and an UPDATE is issued. When false, a physical DELETE is always performed — even if the aggregate implements Entities.ISoftDelete. - Throws: `System.InvalidOperationException` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` This is not yet implemented due to Linq2Db's inability to find primary key or array of primary key. - `primaryKey`: Value of Primary Key - `token`: Cancellation Token - Returns: System.NotImplementedException - Throws: `System.NotImplementedException` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindQuery(ISpecification specification) : IQueryable` ##### `FindQuery(Expression> expression) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize) : IQueryable` ##### `FindQuery(IPagedSpecification specification) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending) : IQueryable` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `Include(Expression> path) : IEagerLoadableQueryable` ##### `ThenInclude(Expression> path) : IEagerLoadableQueryable` ##### `UpdateAsync(TAggregate entity, CancellationToken token) : Task` #### class Linq2DbReadModelRepository A read-model repository implementation using Linq2Db for query operations. ##### `Linq2DbReadModelRepository(IDataStoreFactory dataStoreFactory, ILoggerFactory loggerFactory, IOptions defaultDataStoreOptions)` ##### `AnyAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `DataStoreName : String` ##### `FindAllAsync(ISpecification specification, CancellationToken cancellationToken) : Task>` ##### `FindAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `GetCountAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `GetPagedAsync(IPagedSpecification specification, CancellationToken cancellationToken) : Task>` ##### `Include(Expression> path) : IReadModelRepository` #### class Linq2DbRepository A concrete repository implementation using Linq2Db for CRUD operations and LINQ-based querying. ##### `Linq2DbRepository(IDataStoreFactory dataStoreFactory, ILoggerFactory logger, IEntityEventTracker eventTracker, IOptions defaultDataStoreOptions, ITenantIdAccessor tenantIdAccessor)` ##### `AddAsync(TEntity entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteAsync(TEntity entity, CancellationToken token) : Task` Deletes the entity. If TEntity implements Entities.ISoftDelete, a soft delete is performed automatically (sets IsDeleted = true and issues an UPDATE). Otherwise a physical DELETE is executed. ##### `DeleteAsync(TEntity entity, Boolean isSoftDelete, CancellationToken token) : Task` Deletes the entity using the explicitly specified delete mode. When isSoftDelete is true, the entity must implement Entities.ISoftDelete; its IsDeleted property is set to true and an UPDATE is issued. When false, a physical DELETE is always performed — even if the entity implements Entities.ISoftDelete. - Throws: `System.InvalidOperationException` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` This is not yet implemented due to Linq2Db's inability to find primary key or array of primary key. - `primaryKey`: Value of Primary Key - `token`: Cancellation Token - Returns: System.NotImplementedException - Throws: `System.NotImplementedException` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindQuery(ISpecification specification) : IQueryable` ##### `FindQuery(Expression> expression) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize) : IQueryable` ##### `FindQuery(IPagedSpecification specification) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending) : IQueryable` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `Include(Expression> path) : IEagerLoadableQueryable` ##### `ThenInclude(Expression> path) : IEagerLoadableQueryable` ##### `UpdateAsync(TEntity entity, CancellationToken token) : Task` ### Namespace RCommon.Persistence.Linq2Db.Inbox #### class Linq2DbInboxStore A Linq2Db implementation of Inbox.IInboxStore that persists inbox messages using a Linq2Db.RCommonDataConnection resolved through the Persistence.IDataStoreFactory. ##### `Linq2DbInboxStore(IDataStoreFactory dataStoreFactory, IOptions defaultDataStoreOptions, IOptions outboxOptions)` ##### `CleanupAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `ExistsAsync(Guid messageId, String consumerType, CancellationToken cancellationToken) : Task` ##### `RecordAsync(IInboxMessage message, CancellationToken cancellationToken) : Task` ### Namespace RCommon.Persistence.Linq2Db.Outbox #### class Linq2DbOutboxStore A Linq2Db implementation of Outbox.IOutboxStore that persists outbox messages using a Linq2Db.RCommonDataConnection resolved through the Persistence.IDataStoreFactory. ##### `Linq2DbOutboxStore(IDataStoreFactory dataStoreFactory, IOptions defaultDataStoreOptions, IOptions outboxOptions, ILockStatementProvider lockStatementProvider)` ##### `ClaimAsync(String instanceId, Int32 batchSize, TimeSpan lockDuration, CancellationToken cancellationToken) : Task>` ##### `DeleteDeadLetteredAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `DeleteProcessedAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `GetDeadLettersAsync(Int32 batchSize, Int32 offset, CancellationToken cancellationToken) : Task>` ##### `MarkDeadLetteredAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `MarkFailedAsync(Guid messageId, String error, DateTimeOffset nextRetryAtUtc, CancellationToken cancellationToken) : Task` ##### `MarkProcessedAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `ReplayDeadLetterAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `SaveAsync(IOutboxMessage message, CancellationToken cancellationToken) : Task` ### Namespace RCommon.Persistence.Linq2Db.Sagas #### class Linq2DbSagaStore A Linq2Db implementation of Sagas.ISagaStore`2 that persists saga state using a Linq2Db.RCommonDataConnection resolved through the Persistence.IDataStoreFactory. ##### `Linq2DbSagaStore(IDataStoreFactory dataStoreFactory, ILoggerFactory loggerFactory, IOptions defaultDataStoreOptions)` ##### `DeleteAsync(TState state, CancellationToken ct) : Task` ##### `FindByCorrelationIdAsync(String correlationId, CancellationToken ct) : Task` ##### `GetByIdAsync(TKey id, CancellationToken ct) : Task` ##### `SaveAsync(TState state, CancellationToken ct) : Task` --- ## RCommon.MassTransit ### Namespace RCommon #### class MassTransitEventHandlingBuilderExtensions Extension methods for configuring MassTransit event handling within the RCommon builder pipeline. ##### `AddSubscriber(IMassTransitEventHandlingBuilder builder) : Void` Registers a subscriber for a specific event type and adds the corresponding MassTransit consumer. Also registers the event-to-producer subscription for correct event routing. - `builder`: The MassTransit event handling builder. ##### `WithEventHandling(IRCommonBuilder builder) : IRCommonBuilder` Configures MassTransit event handling with default settings. - `builder`: The RCommon builder. - Returns: The RCommon.IRCommonBuilder for further chaining. ##### `WithEventHandling(IRCommonBuilder builder, Action actions) : IRCommonBuilder` ### Namespace RCommon.MassTransit #### interface IMassTransitEventHandlingBuilder Builder interface for configuring MassTransit-based event handling within the RCommon framework. Combines EventHandling.IEventHandlingBuilder for RCommon event wiring with MassTransit.IBusRegistrationConfigurator for MassTransit bus configuration. #### class MassTransitEventHandlingBuilder Default implementation of MassTransit.IMassTransitEventHandlingBuilder that configures MassTransit consumers and event handling services through the RCommon builder pipeline. Inherits from Configuration.ServiceCollectionBusConfigurator to provide full MassTransit bus registration capabilities. ##### `MassTransitEventHandlingBuilder(IRCommonBuilder builder)` Initializes a new instance of MassTransit.MassTransitEventHandlingBuilder using the provided RCommon builder. - `builder`: The RCommon.IRCommonBuilder whose service collection is used for dependency registration. ##### `Services : IServiceCollection` ### Namespace RCommon.MassTransit.Producers #### class PublishWithMassTransitEventProducer An Producers.IEventProducer implementation that publishes events to all subscribed consumers using MassTransit's IBus.Publish method (fan-out pattern). ##### `PublishWithMassTransitEventProducer(IBus bus, ILogger logger, IServiceProvider serviceProvider, EventSubscriptionManager subscriptionManager)` ##### `ProduceEventAsync(T event, CancellationToken cancellationToken) : Task` #### class SendWithMassTransitEventProducer An Producers.IEventProducer implementation that sends events to a single consumer endpoint using MassTransit's IBus.Send method (point-to-point pattern). ##### `SendWithMassTransitEventProducer(IBus bus, ILogger logger, IServiceProvider serviceProvider, EventSubscriptionManager subscriptionManager)` ##### `ProduceEventAsync(T event, CancellationToken cancellationToken) : Task` ### Namespace RCommon.MassTransit.Subscribers #### interface IMassTransitEventHandler Non-generic marker interface for MassTransit event handlers within the RCommon framework. #### interface IMassTransitEventHandler Generic marker interface for MassTransit event handlers that process a specific distributed event type. #### class MassTransitEventHandler MassTransit consumer that bridges MassTransit message consumption to the RCommon Subscribers.ISubscriber`1 abstraction. Implements both Subscribers.IMassTransitEventHandler`1 and MassTransit's MassTransit.IConsumer`1. ##### `MassTransitEventHandler(ILogger> logger, ISubscriber subscriber)` ##### `Consume(ConsumeContext context) : Task` --- ## RCommon.MassTransit.Outbox ### Namespace RCommon #### class MassTransitOutboxBuilderExtensions ##### `AddOutbox(IMassTransitEventHandlingBuilder builder, Action configure) : IMassTransitEventHandlingBuilder` ### Namespace RCommon.MassTransit.Outbox #### interface IMassTransitOutboxBuilder ##### `UseBusOutbox(Action configure) : IMassTransitOutboxBuilder` ##### `UsePostgres() : IMassTransitOutboxBuilder` ##### `UseSqlServer() : IMassTransitOutboxBuilder` #### class MassTransitOutboxBuilder ##### `MassTransitOutboxBuilder(IEntityFrameworkOutboxConfigurator configurator)` ##### `UseBusOutbox(Action configure) : IMassTransitOutboxBuilder` ##### `UsePostgres() : IMassTransitOutboxBuilder` ##### `UseSqlServer() : IMassTransitOutboxBuilder` --- ## RCommon.MassTransit.StateMachines ### Namespace RCommon #### class MassTransitStateMachineBuilderExtensions Extension methods for registering the MassTransit state machine adapter with the RCommon builder pipeline. ##### `WithMassTransitStateMachine(IRCommonBuilder builder) : IRCommonBuilder` Registers the MassTransit dictionary-based state machine as the implementation for StateMachines.IStateMachineConfigurator`2. - `builder`: The RCommon builder to register services against. - Returns: The RCommon.IRCommonBuilder for further chaining. ### Namespace RCommon.MassTransit.StateMachines #### class MassTransitStateConfigurator Stores per-state configuration for a MassTransit-based state machine, including unconditional transitions, guarded transitions, and entry/exit actions. ##### `MassTransitStateConfigurator(TState state)` ##### `OnEntry(Func action) : IStateConfigurator` ##### `OnExit(Func action) : IStateConfigurator` ##### `Permit(TTrigger trigger, TState destinationState) : IStateConfigurator` ##### `PermitIf(TTrigger trigger, TState destinationState, Func guard) : IStateConfigurator` #### class MassTransitStateMachineConfigurator Configures state machine transitions, guards, and actions, then builds independent StateMachines.IStateMachine`2 instances. Configuration is performed once via MassTransitStateMachineConfigurator`2.ForState calls, while MassTransitStateMachineConfigurator`2.Build can be called many times with different initial states to produce independent machine instances that share the same transition configuration. ##### `MassTransitStateMachineConfigurator()` ##### `Build(TState initialState) : IStateMachine` ##### `ForState(TState state) : IStateConfigurator` #### class MassTransitStateMachine A lightweight dictionary-based finite state machine implementing StateMachines.IStateMachine`2. Each instance is independent and tracks its own current state. ##### `MassTransitStateMachine(TState initialState, Dictionary> stateConfigs)` ##### `CanFire(TTrigger trigger) : Boolean` ##### `CurrentState : TState` ##### `FireAsync(TTrigger trigger, CancellationToken cancellationToken) : Task` ##### `FireAsync(TTrigger trigger, TData data, CancellationToken cancellationToken) : Task` Fires a trigger with associated data. In this implementation the data parameter is ignored and the transition is handled identically to MassTransitStateMachine`2.FireAsync. This is a documented limitation of the dictionary-based FSM adapter. ##### `PermittedTriggers : IEnumerable` --- ## RCommon.Mediator ### Namespace RCommon #### class MediatorBuilderExtensions Provides extension methods on RCommon.IRCommonBuilder for registering a mediator implementation. ##### `WithMediator(IRCommonBuilder builder) : IRCommonBuilder` Registers a mediator implementation using default configuration. - `builder`: The RCommon builder instance. - Returns: The RCommon.IRCommonBuilder for chaining additional configuration calls. ##### `WithMediator(IRCommonBuilder builder, Action actions) : IRCommonBuilder` ### Namespace RCommon.Mediator #### interface IMediatorAdapter Defines an adapter interface that abstracts the underlying mediator implementation (e.g., MediatR, Wolverine). ##### `Publish(TNotification notification, CancellationToken cancellationToken) : Task` Publishes a notification to all registered handlers. - `notification`: The notification object to broadcast. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Tasks.Task representing the asynchronous operation. ##### `Send(TRequest request, CancellationToken cancellationToken) : Task` Sends a request to a single handler with no return value. - `request`: The request object to dispatch. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Tasks.Task representing the asynchronous operation. ##### `Send(TRequest request, CancellationToken cancellationToken) : Task` Sends a request to a single handler and returns a response. - `request`: The request object to dispatch. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Tasks.Task`1 containing the handler's response. #### interface IMediatorBuilder Defines the contract for configuring a mediator implementation within the RCommon framework. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register mediator-related services. #### interface IMediatorService Provides a high-level mediator service for sending requests and publishing notifications. ##### `Publish(TNotification notification, CancellationToken cancellationToken) : Task` Publishes a notification to all registered handlers. - `notification`: The notification object to broadcast to all subscribers. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Tasks.Task representing the asynchronous operation. ##### `Send(TRequest request, CancellationToken cancellationToken) : Task` Sends a request to a single handler with no return value. - `request`: The request object to dispatch. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Tasks.Task representing the asynchronous operation. ##### `Send(TRequest request, CancellationToken cancellationToken) : Task` Sends a request to a single handler and returns a response. - `request`: The request object to dispatch. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Tasks.Task`1 containing the handler's response. #### class MediatorService Default implementation of Mediator.IMediatorService that delegates all operations to an Mediator.IMediatorAdapter. ##### `MediatorService(IMediatorAdapter mediatorAdapter)` Initializes a new instance of Mediator.MediatorService. - `mediatorAdapter`: The mediator adapter that handles the actual dispatch to handlers. ##### `Publish(TNotification notification, CancellationToken cancellationToken) : Task` ##### `Send(TRequest request, CancellationToken cancellationToken) : Task` ##### `Send(TRequest request, CancellationToken cancellationToken) : Task` ### Namespace RCommon.Mediator.Subscribers #### interface IAppNotification Marker interface for notification messages that are broadcast to multiple handlers. #### interface IAppRequest Marker interface for request messages that are dispatched to a single handler with no return value. #### interface IAppRequestHandler Defines a handler for a request that does not return a value. ##### `HandleAsync(TRequest request, CancellationToken cancellationToken) : Task` Handles the specified request asynchronously. - `request`: The request to handle. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Tasks.Task representing the asynchronous operation. #### interface IAppRequestHandler Defines a handler for a request that returns a response. ##### `HandleAsync(TRequest request, CancellationToken cancellationToken) : Task` Handles the specified request asynchronously and returns a response. - `request`: The request to handle. - `cancellationToken`: Optional token to cancel the operation. - Returns: A Tasks.Task`1 containing the handler's response. #### interface IAppRequest Marker interface for request messages that are dispatched to a single handler and return a response. --- ## RCommon.MediatR ### Namespace RCommon #### class MediatRBuilderExtensions Extension methods for configuring notifications, requests, and pipeline behaviors on an MediatR.IMediatRBuilder instance. ##### `AddLoggingToRequestPipeline(IMediatRBuilder builder) : Void` Adds logging pipeline behaviors to the MediatR request pipeline. Registers both Behaviors.LoggingRequestBehavior`2 and Behaviors.LoggingRequestWithResponseBehavior`2. - `builder`: The MediatR builder. ##### `AddNotification(IMediatRBuilder builder) : Void` Registers a notification subscriber and its corresponding MediatR MediatR.INotificationHandler`1. Notifications are delivered to all registered handlers (fan-out). - `builder`: The MediatR builder. ##### `AddRequest(IMediatRBuilder builder) : Void` Registers a request handler for a fire-and-forget request (no response). Requests are handled by a single handler via MediatR's Send method. - `builder`: The MediatR builder. ##### `AddRequest(IMediatRBuilder builder) : Void` Registers a request handler for a request that returns a response. Requests are handled by a single handler via MediatR's Send method. - `builder`: The MediatR builder. ##### `AddUnitOfWorkToRequestPipeline(IMediatRBuilder builder) : Void` Adds unit of work pipeline behaviors to the MediatR request pipeline. Registers both Behaviors.UnitOfWorkRequestBehavior`2 and Behaviors.UnitOfWorkRequestWithResponseBehavior`2 so that each request executes within a transactional unit of work. - `builder`: The MediatR builder. ##### `AddValidationToRequestPipeline(IMediatRBuilder builder) : Void` Adds validation pipeline behaviors to the MediatR request pipeline. Registers both Behaviors.ValidatorBehavior`2 and Behaviors.ValidatorBehaviorForMediatR`2, along with the Validation.IValidationService. - `builder`: The MediatR builder. ### Namespace RCommon.MediatR #### interface IMediatREventHandlingBuilder Builder interface for configuring MediatR-based event handling within the RCommon framework. Extends EventHandling.IEventHandlingBuilder to provide MediatR-specific event subscription capabilities. #### class MediatRAdapter An Adapter for MediatR.IMediator ##### `MediatRAdapter(IMediator mediator)` Initializes a new instance of MediatR.MediatRAdapter. - `mediator`: The MediatR MediatR.IMediator instance to delegate operations to. ##### `Publish(TNotification notification, CancellationToken cancellationToken) : Task` This will wrap the original notification in Subscribers.MediatRNotification`1 and then publish it using MediatR.IMediator - `notification`: - `cancellationToken`: - Returns: This should raise Subscribers.MediatRNotificationHandler`2 which is the default handler for the wrapped notification ##### `Send(TRequest request, CancellationToken cancellationToken) : Task` Wraps the request in a Subscribers.MediatRRequest`1 and sends it via MediatR for single-handler processing. - `request`: The request payload. - `cancellationToken`: Optional cancellation token. ##### `Send(TRequest request, CancellationToken cancellationToken) : Task` Wraps the request in a Subscribers.MediatRRequest`2 and sends it via MediatR, returning the response from the single handler. - `request`: The request payload. - `cancellationToken`: Optional cancellation token. - Returns: The response produced by the request handler. #### class MediatREventHandlingBuilder Default implementation of MediatR.IMediatREventHandlingBuilder that registers MediatR event handling services including the MediatR.MediatRAdapter as the Mediator.IMediatorAdapter. ##### `MediatREventHandlingBuilder(IRCommonBuilder builder)` Initializes a new instance of MediatR.MediatREventHandlingBuilder and registers core services. - `builder`: The RCommon.IRCommonBuilder whose service collection is used for dependency registration. ##### `Services : IServiceCollection` #### class MediatREventHandlingBuilderExtensions Extension methods for configuring MediatR-based event handling within the RCommon builder pipeline. ##### `AddSubscriber(IMediatREventHandlingBuilder builder) : Void` Registers an event subscriber and its corresponding MediatR notification handler for the event handling pipeline. Also registers the event-to-producer subscription for correct routing. - `builder`: The MediatR event handling builder. ##### `WithEventHandling(IRCommonBuilder builder) : IRCommonBuilder` Configures MediatR event handling with default settings and no custom actions. - `builder`: The RCommon builder. - Returns: The RCommon.IRCommonBuilder for further chaining. ##### `WithEventHandling(IRCommonBuilder builder, Action actions) : IRCommonBuilder` ##### `WithEventHandling(IRCommonBuilder builder, Action actions, Action mediatRActions) : IRCommonBuilder` ### Namespace RCommon.MediatR.Producers #### class PublishWithMediatREventProducer An Producers.IEventProducer implementation that publishes events to all notification handlers using MediatR's publish (fan-out) semantics via Mediator.IMediatorService. ##### `PublishWithMediatREventProducer(IMediatorService mediatorService, ILogger logger, IServiceProvider serviceProvider, EventSubscriptionManager subscriptionManager)` ##### `ProduceEventAsync(TEvent event, CancellationToken cancellationToken) : Task` #### class SendWithMediatREventProducer An Producers.IEventProducer implementation that sends events to a single request handler using MediatR's send (point-to-point) semantics via Mediator.IMediatorService. ##### `SendWithMediatREventProducer(IMediatorService mediatorService, ILogger logger, IServiceProvider serviceProvider, EventSubscriptionManager subscriptionManager)` ##### `ProduceEventAsync(TEvent event, CancellationToken cancellationToken) : Task` ### Namespace RCommon.MediatR.Subscribers #### interface IMediatRNotification Non-generic marker interface for MediatR notifications within the RCommon framework. Extends MediatR.INotification to participate in the MediatR pipeline. #### interface IMediatRNotification Generic interface for MediatR notifications that wrap an underlying event payload. ##### `Notification : TEvent` Gets or sets the underlying notification event payload. #### interface IMediatRRequest Non-generic marker interface for MediatR requests within the RCommon framework. Extends MediatR.IRequest for fire-and-forget request semantics. #### interface IMediatRRequest Generic interface for MediatR requests that return a response. Extends both MediatR.IRequest`1 and Subscribers.IMediatRRequest. #### interface IMediatRRequest Generic interface for MediatR requests that wrap an underlying request payload and return a response. ##### `Request : TRequest` Gets the underlying request payload. #### class MediatREventHandler MediatR notification handler that bridges Subscribers.MediatRNotification`1 notifications to RCommon's Subscribers.ISubscriber`1 abstraction for serializable event handling. Resolves the subscriber from the DI container and delegates event handling. ##### `MediatREventHandler(IServiceProvider serviceProvider)` Initializes a new instance of Subscribers.MediatREventHandler`2. - `serviceProvider`: The service provider used to resolve Subscribers.ISubscriber`1 at runtime. ##### `Handle(TNotification notification, CancellationToken cancellationToken) : Task` Handles the MediatR notification by resolving the RCommon subscriber and delegating the event. - `notification`: The MediatR notification containing the wrapped serializable event. - `cancellationToken`: Cancellation token. - Throws: `System.NullReferenceException` #### class MediatRNotificationHandler MediatR notification handler that bridges Subscribers.MediatRNotification`1 notifications to RCommon's Subscribers.ISubscriber`1 abstraction for application notifications. Resolves the subscriber from the DI container and delegates event handling. ##### `MediatRNotificationHandler(IServiceProvider serviceProvider)` Initializes a new instance of Subscribers.MediatRNotificationHandler`2. - `serviceProvider`: The service provider used to resolve Subscribers.ISubscriber`1 at runtime. ##### `Handle(TNotification notification, CancellationToken cancellationToken) : Task` Handles the MediatR notification by resolving the RCommon subscriber and delegating the event. - `notification`: The MediatR notification containing the wrapped event. - `cancellationToken`: Cancellation token. - Throws: `System.NullReferenceException` #### class MediatRNotification Wrapper class that adapts an event of type TEvent into an Subscribers.IMediatRNotification`1 so it can be published through the MediatR notification pipeline. ##### `MediatRNotification(TEvent notification)` Initializes a new instance of Subscribers.MediatRNotification`1 with the specified event payload. - `notification`: The event payload to wrap. ##### `Notification : TEvent` #### class MediatRRequestHandler MediatR request handler that bridges Subscribers.MediatRRequest`1 requests to RCommon's Subscribers.IAppRequestHandler`1 abstraction for fire-and-forget processing. Resolves the handler from the DI container and delegates request handling. ##### `MediatRRequestHandler(IServiceProvider serviceProvider)` Initializes a new instance of Subscribers.MediatRRequestHandler`2. - `serviceProvider`: The service provider used to resolve Subscribers.IAppRequestHandler`1 at runtime. ##### `Handle(TRequest request, CancellationToken cancellationToken) : Task` Handles the MediatR request by resolving the RCommon request handler and delegating the request. - `request`: The MediatR request containing the wrapped application request. - `cancellationToken`: Cancellation token. - Throws: `System.NullReferenceException` #### class MediatRRequestHandler MediatR request handler that bridges Subscribers.MediatRRequest`2 requests to RCommon's Subscribers.IAppRequestHandler`2 abstraction for request/response processing. Resolves the handler from the DI container and delegates request handling. ##### `MediatRRequestHandler(IServiceProvider serviceProvider)` Initializes a new instance of Subscribers.MediatRRequestHandler`3. - `serviceProvider`: The service provider used to resolve Subscribers.IAppRequestHandler`2 at runtime. ##### `Handle(TRequest request, CancellationToken cancellationToken) : Task` Handles the MediatR request by resolving the RCommon request handler and delegating the request. - `request`: The MediatR request containing the wrapped application request. - `cancellationToken`: Cancellation token. - Returns: The response produced by the resolved application request handler. - Throws: `System.NullReferenceException` #### class MediatRRequest Wrapper class that adapts a request of type TRequest into an Subscribers.IMediatRRequest`1 for fire-and-forget processing through the MediatR pipeline. ##### `MediatRRequest(TRequest request)` Initializes a new instance of Subscribers.MediatRRequest`1 with the specified request payload. - `request`: The request payload to wrap. ##### `Request : TRequest` #### class MediatRRequest Wrapper class that adapts a request of type TRequest into an Subscribers.IMediatRRequest`2 for request/response processing through the MediatR pipeline. ##### `MediatRRequest(TRequest request)` Initializes a new instance of Subscribers.MediatRRequest`2 with the specified request payload. - `request`: The request payload to wrap. ##### `Request : TRequest` ### Namespace RCommon.Mediator.MediatR #### interface IMediatRBuilder Builder interface for configuring the MediatR mediator implementation within RCommon. Extends Mediator.IMediatorBuilder with MediatR-specific configuration methods. ##### `Configure(Action options) : IMediatRBuilder` ##### `Configure(MediatRServiceConfiguration options) : IMediatRBuilder` Configures MediatR services using a pre-built configuration instance. - `options`: The DependencyInjection.MediatRServiceConfiguration to apply. - Returns: The builder instance for fluent chaining. #### class MediatRBuilder Default implementation of MediatR.IMediatRBuilder that registers MediatR services and the MediatR.MediatRAdapter as the Mediator.IMediatorAdapter within the DI container. ##### `MediatRBuilder(IRCommonBuilder builder)` Initializes a new instance of MediatR.MediatRBuilder and registers core MediatR services. - `builder`: The RCommon.IRCommonBuilder whose service collection is used for dependency registration. ##### `Configure(Action options) : IMediatRBuilder` ##### `Configure(MediatRServiceConfiguration options) : IMediatRBuilder` ##### `Services : IServiceCollection` ### Namespace RCommon.Mediator.MediatR.Behaviors #### class LoggingRequestBehavior MediatR pipeline behavior that logs the handling of fire-and-forget requests (no explicit response type). Logs the command name and payload before and after the handler executes. ##### `LoggingRequestBehavior(ILogger> logger)` ##### `Handle(TRequest request, RequestHandlerDelegate next, CancellationToken cancellationToken) : Task` #### class LoggingRequestWithResponseBehavior MediatR pipeline behavior that logs the handling of requests that return a response. Logs the command name and payload before and after the handler executes. ##### `LoggingRequestWithResponseBehavior(ILogger> logger)` ##### `Handle(TRequest request, RequestHandlerDelegate next, CancellationToken cancellationToken) : Task` #### class UnitOfWorkRequestBehavior MediatR pipeline behavior that wraps fire-and-forget request handling in a transactional unit of work. Creates a unit of work before the handler executes and commits it upon successful completion. ##### `UnitOfWorkRequestBehavior(IUnitOfWorkFactory unitOfWorkScopeFactory, ILogger> logger)` ##### `Handle(TRequest request, RequestHandlerDelegate next, CancellationToken cancellationToken) : Task` #### class UnitOfWorkRequestWithResponseBehavior MediatR pipeline behavior that wraps request-with-response handling in a transactional unit of work. Creates a unit of work before the handler executes and commits it upon successful completion. ##### `UnitOfWorkRequestWithResponseBehavior(IUnitOfWorkFactory unitOfWorkScopeFactory, ILogger> logger)` ##### `Handle(TRequest request, RequestHandlerDelegate next, CancellationToken cancellationToken) : Task` #### class ValidatorBehaviorForMediatR MediatR pipeline behavior that validates requests implementing MediatR.IRequest`1 before they reach the handler. Uses Validation.IValidationService to perform validation, throwing on failure to prevent invalid requests from being processed. ##### `ValidatorBehaviorForMediatR(IValidationService validationService, ILogger> logger)` ##### `Handle(TRequest request, RequestHandlerDelegate next, CancellationToken cancellationToken) : Task` #### class ValidatorBehavior MediatR pipeline behavior that validates requests implementing Subscribers.IAppRequest`1 before they reach the handler. Uses Validation.IValidationService to perform validation, throwing on failure to prevent invalid requests from being processed. ##### `ValidatorBehavior(IValidationService validationService, ILogger> logger)` ##### `Handle(TRequest request, RequestHandlerDelegate next, CancellationToken cancellationToken) : Task` --- ## RCommon.MemoryCache ### Namespace RCommon.MemoryCache #### class DistributedMemoryCacheBuilder Builder for configuring distributed memory caching using the Microsoft Distributed.IDistributedCache abstraction backed by an in-memory store. ##### `DistributedMemoryCacheBuilder(IRCommonBuilder builder)` Initializes a new instance of the MemoryCache.DistributedMemoryCacheBuilder class. - `builder`: The RCommon builder whose DependencyInjection.IServiceCollection is used for service registration. ##### `Services : IServiceCollection` #### class DistributedMemoryCacheService A proxy for distributed memory caching implemented through the Distributed.IDistributedCache abstraction. ##### `DistributedMemoryCacheService(IDistributedCache distributedCache, IJsonSerializer jsonSerializer)` Initializes a new instance of the MemoryCache.DistributedMemoryCacheService class. - `distributedCache`: The underlying distributed cache implementation. - `jsonSerializer`: The JSON serializer used to serialize/deserialize cached values. ##### `GetOrCreate(Object key, Func data) : TData` ##### `GetOrCreateAsync(Object key, Func data) : Task` #### interface IDistributedMemoryCachingBuilder Marker interface for configuring distributed caching that is backed by an in-memory store. #### class IDistributedMemoryCachingBuilderExtensions Extension methods for MemoryCache.IDistributedMemoryCachingBuilder that configure distributed memory cache options and expression caching. ##### `CacheDynamicallyCompiledExpressions(IDistributedMemoryCachingBuilder builder) : IDistributedMemoryCachingBuilder` This greatly improves performance across various areas of RCommon which use generics and reflection heavily to compile expressions and lambdas - `builder`: Builder - Returns: Same builder to allow chaining ##### `Configure(IDistributedMemoryCachingBuilder builder, Action actions) : IDistributedMemoryCachingBuilder` #### interface IInMemoryCachingBuilder Marker interface for configuring in-memory caching backed by Memory.IMemoryCache. #### class IInMemoryCachingBuilderExtensions Extension methods for MemoryCache.IInMemoryCachingBuilder that configure in-memory cache options and expression caching. ##### `CacheDynamicallyCompiledExpressions(IInMemoryCachingBuilder builder) : IInMemoryCachingBuilder` This greatly improves performance across various areas of RCommon which use generics and reflection heavily to compile expressions and lambdas - `builder`: Builder - Returns: Same builder to allow chaining ##### `Configure(IInMemoryCachingBuilder builder, Action actions) : IInMemoryCachingBuilder` #### class InMemoryCacheService A proxy for in-process memory caching implemented through the Memory.IMemoryCache abstraction. ##### `InMemoryCacheService(IMemoryCache memoryCache)` Initializes a new instance of the MemoryCache.InMemoryCacheService class. - `memoryCache`: The underlying Memory.IMemoryCache implementation. ##### `GetOrCreate(Object key, Func data) : TData` ##### `GetOrCreateAsync(Object key, Func data) : Task` #### class InMemoryCachingBuilder Builder for configuring in-memory caching using the Microsoft Memory.IMemoryCache abstraction. ##### `InMemoryCachingBuilder(IRCommonBuilder builder)` Initializes a new instance of the MemoryCache.InMemoryCachingBuilder class. - `builder`: The RCommon builder whose DependencyInjection.IServiceCollection is used for service registration. ##### `Services : IServiceCollection` --- ## RCommon.Models ### Namespace RCommon.Models #### interface IModel Base marker interface for all models in the RCommon framework. Implementing this interface identifies a type as an RCommon model, enabling consistent type constraints across commands, queries, events, and execution results. #### interface IPagedResult ##### `HasNextPage : Boolean` ##### `HasPreviousPage : Boolean` ##### `Items : IReadOnlyList` ##### `PageNumber : Int32` ##### `PageSize : Int32` ##### `TotalCount : Int64` ##### `TotalPages : Int32` #### interface IPaginatedListRequest Defines the contract for a paginated list request, specifying paging and sorting parameters used to retrieve a subset of data from a larger collection. ##### `PageNumber : Int32` Gets or sets the one-based page number to retrieve. ##### `PageSize : Int32` Gets or sets the number of items per page. ##### `SortBy : String` Gets or sets the name of the property to sort by. ##### `SortDirection : SortDirectionEnum` Gets or sets the sort direction (ascending, descending, or none). #### interface ISearchPaginatedListRequest Extends paginated list requests with a free-text search capability. Implementations combine search filtering with pagination and sorting. ##### `SearchString : String` Gets or sets the search string used to filter results. #### class PagedResult ##### `PagedResult(IReadOnlyList items, Int64 totalCount, Int32 pageNumber, Int32 pageSize)` ##### `HasNextPage : Boolean` ##### `HasPreviousPage : Boolean` ##### `Items : IReadOnlyList` ##### `PageNumber : Int32` ##### `PageSize : Int32` ##### `TotalCount : Int64` ##### `TotalPages : Int32` #### class PaginatedListModel Represents a Data Transfer Object (DTO) that is typically used to encapsulate a PaginatedList so that it can be delivered to the application layer. This should be an immutable object. ##### `$() : PaginatedListModel` ##### `Equals(Object obj) : Boolean` ##### `Equals(PaginatedListModel other) : Boolean` ##### `GetHashCode() : Int32` ##### `HasNextPage : Boolean` Gets a value indicating whether there is a page after the current page. ##### `HasPreviousPage : Boolean` Gets a value indicating whether there is a page before the current page. ##### `Items : List` Gets or sets the list of items for the current page. ##### `PageNumber : Int32` Gets or sets the one-based page number. ##### `PageSize : Int32` Gets or sets the number of items per page. ##### `SortBy : String` Gets or sets the name of the property used for sorting. ##### `SortDirection : SortDirectionEnum` Gets or sets the sort direction applied to the results. ##### `ToString() : String` ##### `TotalCount : Int32` Gets or sets the total count of items across all pages. ##### `TotalPages : Int32` Gets or sets the total number of pages available. #### class PaginatedListModel Represents a Data Transfer Object (DTO) that is typically used to encapsulate a PaginatedList so that it can be delivered to the application layer. This should be an immutable object. ##### `$() : PaginatedListModel` ##### `Equals(Object obj) : Boolean` ##### `Equals(PaginatedListModel other) : Boolean` ##### `GetHashCode() : Int32` ##### `HasNextPage : Boolean` Gets a value indicating whether there is a page after the current page. ##### `HasPreviousPage : Boolean` Gets a value indicating whether there is a page before the current page. ##### `Items : List` Gets or sets the list of items for the current page, projected to TOut. ##### `PageNumber : Int32` Gets or sets the one-based page number. ##### `PageSize : Int32` Gets or sets the number of items per page. ##### `SortBy : String` Gets or sets the name of the property used for sorting. ##### `SortDirection : SortDirectionEnum` Gets or sets the sort direction applied to the results. ##### `ToString() : String` ##### `TotalCount : Int32` Gets or sets the total count of items across all pages. ##### `TotalPages : Int32` Gets or sets the total number of pages available. #### class PaginatedListRequest Abstract base record providing default pagination and sorting parameters. Derive from this class to create concrete paginated list request types. ##### `PaginatedListRequest()` Initializes a new instance of Models.PaginatedListRequest with default values: page 1, page size 20, sort by "id", and no sort direction. ##### `$() : PaginatedListRequest` ##### `Equals(Object obj) : Boolean` ##### `Equals(PaginatedListRequest other) : Boolean` ##### `GetHashCode() : Int32` ##### `PageNumber : Int32` ##### `PageSize : Int32` ##### `SortBy : String` ##### `SortDirection : SortDirectionEnum` ##### `ToString() : String` #### class SearchPaginatedListRequest A paginated list request that includes a free-text search filter. Combines pagination/sorting from Models.PaginatedListRequest with the search capability defined by Models.ISearchPaginatedListRequest. ##### `SearchPaginatedListRequest()` Initializes a new instance of Models.SearchPaginatedListRequest with default pagination values inherited from Models.PaginatedListRequest. ##### `$() : SearchPaginatedListRequest` ##### `Equals(Object obj) : Boolean` ##### `Equals(PaginatedListRequest other) : Boolean` ##### `Equals(SearchPaginatedListRequest other) : Boolean` ##### `GetHashCode() : Int32` ##### `SearchString : String` ##### `ToString() : String` #### enum SortDirectionEnum Specifies the direction in which a collection should be sorted. ##### `Ascending : SortDirectionEnum` Sort in ascending order (A-Z, 0-9). ##### `Descending : SortDirectionEnum` Sort in descending order (Z-A, 9-0). ##### `None : SortDirectionEnum` No sorting is applied; the default order is preserved. ##### `value__ : Byte` ### Namespace RCommon.Models.Commands #### class CommandResult Default implementation of Commands.ICommandResult`1 that wraps an execution result returned from a command handler. ##### `CommandResult(TExecutionResult result)` Initializes a new instance of the Commands.CommandResult`1 record. - `result`: The execution result representing the outcome of the command. ##### `$() : CommandResult` ##### `Equals(Object obj) : Boolean` ##### `Equals(CommandResult other) : Boolean` ##### `GetHashCode() : Int32` ##### `Result : TExecutionResult` ##### `ToString() : String` #### interface ICommand Marker interface representing a command in the CQRS pattern. Commands encapsulate intent to change the system state and are typically dispatched to a single handler for processing. #### interface ICommandResult Represents the result of executing a command, wrapping an ExecutionResults.IExecutionResult to indicate whether the command succeeded or failed. ##### `Result : TExecutionResult` Gets the execution result indicating the outcome of the command. #### interface ICommand Generic command interface that specifies the expected execution result type. Use this interface when a command handler should return a typed result indicating the outcome of the operation. ### Namespace RCommon.Models.Events #### interface IAsyncEvent Marker interface for events that are dispatched and handled asynchronously. Async events are typically published to a message bus or queue for eventual processing. #### interface ISerializableEvent Marker interface indicating that an event can be serialized for transport across process boundaries (e.g., message queues, event stores, distributed systems). #### interface ISyncEvent Marker interface for events that are dispatched and handled synchronously within the same process boundary. ### Namespace RCommon.Models.ExecutionResults #### class ExecutionResult Abstract base record for execution results, providing factory methods to create ExecutionResults.SuccessExecutionResult and ExecutionResults.FailedExecutionResult instances. ##### `$() : ExecutionResult` ##### `Equals(Object obj) : Boolean` ##### `Equals(ExecutionResult other) : Boolean` ##### `Failed() : IExecutionResult` Returns a cached ExecutionResults.FailedExecutionResult instance with no error messages. - Returns: An ExecutionResults.IExecutionResult representing a failed operation. ##### `Failed(IEnumerable errors) : IExecutionResult` ##### `Failed(String[] errors) : IExecutionResult` Creates a new ExecutionResults.FailedExecutionResult with the specified error messages. - `errors`: One or more error messages describing the failure. - Returns: An ExecutionResults.IExecutionResult representing a failed operation with error details. ##### `GetHashCode() : Int32` ##### `IsSuccess : Boolean` ##### `Success() : IExecutionResult` Returns a cached ExecutionResults.SuccessExecutionResult instance. - Returns: An ExecutionResults.IExecutionResult representing a successful operation. ##### `ToString() : String` Returns a string representation of the execution result, including the success status. - Returns: A string in the format "ExecutionResult - IsSuccess:{value}". #### class FailedExecutionResult Represents a failed execution result, optionally containing one or more error messages that describe the reason(s) for failure. ##### `FailedExecutionResult(IEnumerable errors)` ##### `$() : FailedExecutionResult` ##### `Equals(Object obj) : Boolean` ##### `Equals(ExecutionResult other) : Boolean` ##### `Equals(FailedExecutionResult other) : Boolean` ##### `Errors : IReadOnlyCollection` Gets the collection of error messages associated with the failure. ##### `GetHashCode() : Int32` ##### `IsSuccess : Boolean` ##### `ToString() : String` Returns a string describing the failure, including error messages if any are present. - Returns: A human-readable description of the failure and its associated errors. #### interface IExecutionResult Represents the outcome of an operation, indicating success or failure. This is the base contract for all execution results used by commands and handlers. ##### `IsSuccess : Boolean` Gets a value indicating whether the operation completed successfully. #### class SuccessExecutionResult Represents a successful execution result with ExecutionResult.IsSuccess set to true. ##### `SuccessExecutionResult()` ##### `$() : SuccessExecutionResult` ##### `Equals(Object obj) : Boolean` ##### `Equals(ExecutionResult other) : Boolean` ##### `Equals(SuccessExecutionResult other) : Boolean` ##### `GetHashCode() : Int32` ##### `IsSuccess : Boolean` ##### `ToString() : String` Returns a human-readable string indicating successful execution. - Returns: The string "Successful execution". ### Namespace RCommon.Models.Queries #### interface IQuery Marker interface representing a query in the CQRS pattern. Queries encapsulate the intent to read data without modifying system state. #### interface IQuery Generic query interface that specifies the expected result type. Use this interface when a query handler should return a typed result. --- ## RCommon.MultiTenancy ### Namespace RCommon.MultiTenancy #### interface IMultiTenantBuilder Defines the builder interface for configuring multitenancy services. Concrete implementations (e.g., Finbuckle) register their tenant resolution and Crud.ITenantIdAccessor implementations through this builder. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register multitenancy services. #### class MultiTenancyBuilderExtensions Extension methods for RCommon.IRCommonBuilder that register multitenancy services. ##### `WithMultiTenancy(IRCommonBuilder builder, Action actions) : IRCommonBuilder` --- ## RCommon.Persistence ### Namespace RCommon #### class DefaultDataStoreOptions Options for configuring the default data store name that repositories will use when no explicit INamedDataSource.DataStoreName is specified. ##### `DefaultDataStoreOptions()` Initializes a new instance of the RCommon.DefaultDataStoreOptions class. ##### `DefaultDataStoreName : String` Gets or sets the name of the default data store to be used by repositories. #### interface IPersistenceBuilder Base interface implemented by specific data configurators that configure RCommon data providers. ##### `Services : IServiceCollection` Gets the DependencyInjection.IServiceCollection used to register persistence-related services. ##### `SetDefaultDataStore(Action options) : IPersistenceBuilder` #### class InboxPersistenceBuilderExtensions ##### `AddInbox(IPersistenceBuilder builder) : IPersistenceBuilder` #### class OutboxPersistenceBuilderExtensions ##### `AddOutbox(IPersistenceBuilder builder, Action configure) : IPersistenceBuilder` #### class PersistenceBuilderExtensions Extension methods for RCommon.IRCommonBuilder that register persistence providers and unit of work services. ##### `WithPersistence(IRCommonBuilder builder) : IRCommonBuilder` Adds a persistence provider with default configuration. - `builder`: The RCommon builder instance. - Returns: The RCommon.IRCommonBuilder for fluent chaining. ##### `WithPersistence(IRCommonBuilder builder, Action objectAccessActions) : IRCommonBuilder` ##### `WithPersistence(IRCommonBuilder builder) : IRCommonBuilder` Deprecated. Use PersistenceBuilderExtensions.WithPersistence``1 or PersistenceBuilderExtensions.WithPersistence``1 and if unit of work is required then use in conjuction with PersistenceBuilderExtensions.WithUnitOfWork``1 - `builder`: ##### `WithPersistence(IRCommonBuilder builder, Action objectAccessActions) : IRCommonBuilder` ##### `WithPersistence(IRCommonBuilder builder, Action uniOfWorkActions) : IRCommonBuilder` ##### `WithPersistence(IRCommonBuilder builder, Action objectAccessActions, Action unitOfWorkActions) : IRCommonBuilder` ##### `WithUnitOfWork(IRCommonBuilder builder, Action unitOfWorkActions) : IRCommonBuilder` ### Namespace RCommon.Persistence #### class DataStoreFactory Default implementation of Persistence.IDataStoreFactory that resolves named data stores from the DI container based on registered Persistence.DataStoreValue entries. ##### `DataStoreFactory(IServiceProvider provider, IOptions options)` ##### `Resolve(String name) : C` ##### `Resolve(String name) : B` #### class DataStoreFactoryOptions Configuration options for Persistence.DataStoreFactory that holds the collection of registered Persistence.DataStoreValue entries used to resolve data stores by name and type. ##### `DataStoreFactoryOptions()` ##### `Register(String name) : Void` Registers a data store mapping with the specified name, base type, and concrete type. - `name`: A unique name identifying the data store registration. - Throws: `RCommon.Persistence.UnsupportedDataStoreException` ##### `Values : ConcurrentBag` Gets the thread-safe collection of registered Persistence.DataStoreValue entries. #### class DataStoreNotFoundException Exception thrown when a named data store cannot be found in the Persistence.IDataStoreFactory registry. ##### `DataStoreNotFoundException(String message)` Initializes a new instance of the Persistence.DataStoreNotFoundException class with a specified error message. - `message`: A message describing which data store could not be found. #### class DataStoreValue Represents a named data store registration that maps a base type to a concrete type, used by Persistence.DataStoreFactory to resolve data stores from the DI container. ##### `DataStoreValue(String name, Type baseType, Type concreteType)` Initializes a new instance of the Persistence.DataStoreValue class. - `name`: The unique name identifying this data store registration. - `baseType`: The base type (e.g., a provider-specific DbContext base class). - `concreteType`: The concrete type that directly inherits from baseType. - Throws: `RCommon.Persistence.UnsupportedDataStoreException` ##### `BaseType : Type` Gets the base type used for resolving this data store. ##### `ConcreteType : Type` Gets the concrete type that will be resolved from the DI container. ##### `Name : String` Gets the unique name identifying this data store registration. #### interface IDataStore Represents an abstraction over a data store (e.g., a database context or connection) that supports async disposal. ##### `GetDbConnection() : DbConnection` Gets the underlying Common.DbConnection associated with this data store. - Returns: A Common.DbConnection instance that can be used for direct database operations. #### interface IDataStoreFactory Abstraction for allowing repositories to find Data Stores ##### `Resolve(String name) : C` Resolves a data store value to it's concrete type - `name`: Name of Persistence.DataStoreValue - Returns: Concrete Type of Persistence.DataStoreValue ##### `Resolve(String name) : B` Resolves a data store value to it's base type - `name`: Name of Persistence.DataStoreValue - Returns: Base Type of Persistence.DataStoreValue #### interface INamedDataSource Indicates that a component (such as a repository) is associated with a named data source, allowing it to be resolved from a Persistence.IDataStoreFactory by name. ##### `DataStoreName : String` Gets or sets the name of the data store this component is associated with. #### interface IReadModel Marker interface for read-model/projection types used in CQRS query-side repositories. Read models are optimized for querying and do not participate in domain event tracking. #### interface IScopedDataStore Represents a scoped registry of data stores, allowing multiple named data store types to be tracked within a single scope (e.g., a request or unit of work). ##### `DataStores : ConcurrentDictionary` Gets or sets the thread-safe dictionary that maps data store names to their corresponding System.Type entries. #### class PersistenceException Exception thrown when a general persistence operation fails. ##### `PersistenceException(String message, Exception exception)` Initializes a new instance of the Persistence.PersistenceException class. - `message`: A message describing the persistence failure. - `exception`: The inner exception that caused this persistence error. #### class UnsupportedDataStoreException Exception thrown when a data store registration or resolution is not supported, such as registering a duplicate data store name or an invalid type hierarchy. ##### `UnsupportedDataStoreException(String message)` Initializes a new instance of the Persistence.UnsupportedDataStoreException class with a specified error message. - `message`: A message describing the unsupported data store operation. ### Namespace RCommon.Persistence.Crud #### class GraphRepositoryBase A base class for implementors of Crud.IGraphRepository`1 that provides graph-based (change-tracked) repository functionality on top of Crud.LinqRepositoryBase`1. ##### `GraphRepositoryBase(IDataStoreFactory dataStoreFactory, IEntityEventTracker eventTracker, IOptions defaultDataStoreOptions, ITenantIdAccessor tenantIdAccessor)` ##### `Tracking : Boolean` #### interface IAggregateRepository DDD-constrained repository for aggregate roots. Provides only aggregate-appropriate operations: load by ID, find by specification, existence check, add, update, delete, and eager loading. Does not expose IQueryable or collection queries. ##### `AddAsync(TAggregate aggregate, CancellationToken cancellationToken) : Task` ##### `DeleteAsync(TAggregate aggregate, CancellationToken cancellationToken) : Task` ##### `ExistsAsync(TKey id, CancellationToken cancellationToken) : Task` ##### `FindAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `GetByIdAsync(TKey id, CancellationToken cancellationToken) : Task` ##### `Include(Expression> path) : IAggregateRepository` ##### `ThenInclude(Expression> path) : IAggregateRepository` ##### `UpdateAsync(TAggregate aggregate, CancellationToken cancellationToken) : Task` #### interface IEagerLoadableQueryable Extends Linq.IQueryable`1 and Crud.IReadOnlyRepository`1 with support for chained eager loading of related navigation properties. ##### `ThenInclude(Expression> path) : IEagerLoadableQueryable` #### interface IGraphRepository A repository that supports graph-based (change-tracked) operations on entities of type TEntity, extending Crud.ILinqRepository`1 with change tracking control. ##### `Tracking : Boolean` Gets or sets whether entity change tracking is enabled for this repository. #### interface ILinqRepository A LINQ-enabled repository that combines read, write, queryable, and eager loading capabilities for entities of type TEntity. ##### `FindAsync(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindAsync(IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindQuery(ISpecification specification) : IQueryable` ##### `FindQuery(Expression> expression) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize) : IQueryable` ##### `FindQuery(IPagedSpecification specification) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending) : IQueryable` ##### `Include(Expression> path) : IEagerLoadableQueryable` #### interface IReadModelRepository ##### `AnyAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `FindAllAsync(ISpecification specification, CancellationToken cancellationToken) : Task>` ##### `FindAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `GetCountAsync(ISpecification specification, CancellationToken cancellationToken) : Task` ##### `GetPagedAsync(IPagedSpecification specification, CancellationToken cancellationToken) : Task>` ##### `Include(Expression> path) : IReadModelRepository` #### interface IReadOnlyRepository Defines read-only repository operations for querying entities of type TEntity. ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` Finds a single entity by its primary key. - `primaryKey`: The primary key value of the entity to find. - `token`: A cancellation token to observe. - Returns: The entity if found; otherwise, the default value for TEntity. ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` #### interface ISqlMapperRepository A repository that provides SQL-mapped (micro-ORM) CRUD operations for entities of type TEntity. ##### `TableName : String` Gets or sets the database table name that this repository maps to. #### interface IWriteOnlyRepository Defines write-only repository operations for persisting entities of type TEntity. ##### `AddAsync(TEntity entity, CancellationToken token) : Task` Adds a transient instance of entity to be tracked and persisted by the repository. - `entity`: An instance of TEntity to be persisted. - `token`: Cancellation Token - Returns: Task ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `DeleteAsync(TEntity entity, CancellationToken token) : Task` Deletes the specified entity. If TEntity implements Entities.ISoftDelete, a soft delete is performed automatically (sets IsDeleted = true and issues an UPDATE). Otherwise a physical DELETE is executed. Use IWriteOnlyRepository`1.DeleteAsync to explicitly control the delete mode. - `entity`: An instance of TEntity to delete. - `token`: Cancellation Token - Returns: Task ##### `DeleteAsync(TEntity entity, Boolean isSoftDelete, CancellationToken token) : Task` Deletes the entity using the explicitly specified delete mode, bypassing auto-detection. When isSoftDelete is true, the entity's ISoftDelete.IsDeleted property is set to true and an UPDATE is issued. When false, a physical DELETE is always performed — even if the entity implements Entities.ISoftDelete. - `entity`: The entity to delete. - `isSoftDelete`: If true, performs a soft delete; if false, forces a physical delete. - `token`: Cancellation Token - Returns: Task - Throws: `System.InvalidOperationException` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `UpdateAsync(TEntity entity, CancellationToken token) : Task` Marks the changes of an existing entity to be updated in the store. - `entity`: An instance of TEntity to be persisted. - `token`: Cancellation Token - Returns: Task #### class LinqRepositoryBase Abstract base class for LINQ-enabled repositories that provides common queryable infrastructure, event tracking, and data store resolution for entities of type TEntity. ##### `LinqRepositoryBase(IDataStoreFactory dataStoreFactory, IEntityEventTracker eventTracker, IOptions defaultDataStoreOptions, ITenantIdAccessor tenantIdAccessor)` ##### `AddAsync(TEntity entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DataStoreName : String` ##### `DeleteAsync(TEntity entity, CancellationToken token) : Task` ##### `DeleteAsync(TEntity entity, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `ElementType : Type` Gets the type of the element(s) that are returned when the expression tree associated with this instance of Linq.IQueryable is executed. - Returns: A System.Type that represents the type of the element(s) that are returned when the expression tree associated with this object is executed. ##### `EventTracker : IEntityEventTracker` Gets the entity event tracker used to track and publish domain events raised by entities. ##### `Expression : Expression` Gets the expression tree that is associated with the instance of Linq.IQueryable. - Returns: The LinqRepositoryBase`1.Expression that is associated with this instance of Linq.IQueryable. ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` ##### `FindAsync(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindAsync(IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindQuery(ISpecification specification) : IQueryable` ##### `FindQuery(Expression> expression) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize) : IQueryable` ##### `FindQuery(IPagedSpecification specification) : IQueryable` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `GetEnumerator() : IEnumerator` Returns an enumerator that iterates through the collection. - Returns: A Generic.IEnumerator`1 that can be used to iterate through the collection. ##### `Include(Expression> path) : IEagerLoadableQueryable` ##### `Logger : ILogger` Gets or sets the logger instance for this repository. ##### `Provider : IQueryProvider` Gets the query provider that is associated with this data source. - Returns: The Linq.IQueryProvider that is associated with this data source. ##### `Query(ISpecification specification) : IEnumerable` ##### `ThenInclude(Expression> path) : IEagerLoadableQueryable` ##### `UpdateAsync(TEntity entity, CancellationToken token) : Task` #### class MultiTenantHelper Provides shared validation and operations for multitenancy functionality across repository implementations. ##### `CombineWithTenantFilter(Expression> expression, String tenantId) : Expression>` ##### `EnsureMultiTenant() : Void` Validates that the entity type TEntity implements Entities.IMultiTenant. Call this at the start of any tenant-specific code path to fail fast with a clear error message. - Throws: `System.InvalidOperationException` ##### `GetTenantFilter(String tenantId) : Expression>` Returns an expression that filters entities by the specified tenant: e => e.TenantId == tenantId. Only call this when MultiTenantHelper.IsMultiTenant``1 returns true. - `tenantId`: The tenant ID to filter by. - Returns: An expression representing e => e.TenantId == tenantId. ##### `IsMultiTenant() : Boolean` Returns true if the entity type TEntity implements Entities.IMultiTenant. - Returns: true if TEntity implements Entities.IMultiTenant; otherwise false. ##### `SetTenantIdIfApplicable(Object entity, String tenantId) : Void` Sets the IMultiTenant.TenantId on the entity if it implements Entities.IMultiTenant and the provided tenantId is not null or empty. - `entity`: The entity to stamp with a tenant ID. - `tenantId`: The current tenant ID, or null if no tenant context is available. #### class RepositoryException Exception thrown when a repository operation fails. ##### `RepositoryException(String message, Exception innerException)` Initializes a new instance of the Crud.RepositoryException class. - `message`: A message describing the repository operation failure. - `innerException`: The inner exception that caused this error. #### class SoftDeleteHelper Provides shared validation and operations for soft-delete functionality across repository implementations. ##### `CombineWithNotDeletedFilter(Expression> expression) : Expression>` ##### `EnsureSoftDeletable() : Void` Validates that the entity type TEntity implements Entities.ISoftDelete. Call this at the start of any soft-delete code path to fail fast with a clear error message. - Throws: `System.InvalidOperationException` ##### `GetNotDeletedFilter() : Expression>` Returns an expression that filters out soft-deleted entities: e => !e.IsDeleted. Only call this when SoftDeleteHelper.IsSoftDeletable``1 returns true. - Returns: An expression representing e => !e.IsDeleted. ##### `IsSoftDeletable() : Boolean` Returns true if the entity type TEntity implements Entities.ISoftDelete. Used by repository delete methods to automatically choose soft delete when the entity supports it. - Returns: true if TEntity implements Entities.ISoftDelete; otherwise false. ##### `MarkAsDeleted(Object entity) : Void` Marks the entity as soft-deleted by setting ISoftDelete.IsDeleted to true. The caller must have already validated that the entity implements Entities.ISoftDelete by calling SoftDeleteHelper.EnsureSoftDeletable``1 beforehand. - `entity`: The entity to mark as deleted. Must implement Entities.ISoftDelete. #### class SqlRepositoryBase Abstract base class for SQL-mapped (micro-ORM) repositories that provides common infrastructure for data store resolution, event tracking, and CRUD operations for entities of type TEntity. ##### `SqlRepositoryBase(IDataStoreFactory dataStoreFactory, ILoggerFactory logger, IEntityEventTracker eventTracker, IOptions defaultDataStoreOptions, ITenantIdAccessor tenantIdAccessor)` ##### `AddAsync(TEntity entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DataStoreName : String` ##### `DeleteAsync(TEntity entity, CancellationToken token) : Task` ##### `DeleteAsync(TEntity entity, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `EventTracker : IEntityEventTracker` Gets the entity event tracker used to track and publish domain events raised by entities. ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `Logger : ILogger` Gets or sets the logger instance for this repository. ##### `TableName : String` ##### `UpdateAsync(TEntity entity, CancellationToken token) : Task` ### Namespace RCommon.Persistence.Inbox #### interface IInboxMessage ##### `ConsumerType : String` ##### `EventType : String` ##### `MessageId : Guid` ##### `ReceivedAtUtc : DateTimeOffset` #### interface IInboxStore ##### `CleanupAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `ExistsAsync(Guid messageId, String consumerType, CancellationToken cancellationToken) : Task` ##### `RecordAsync(IInboxMessage message, CancellationToken cancellationToken) : Task` #### class InboxMessage ##### `InboxMessage()` ##### `ConsumerType : String` ##### `EventType : String` ##### `MessageId : Guid` ##### `ReceivedAtUtc : DateTimeOffset` ### Namespace RCommon.Persistence.Outbox #### class ExponentialBackoffStrategy ##### `ExponentialBackoffStrategy(TimeSpan baseDelay, TimeSpan maxDelay, Double multiplier)` ##### `ComputeDelay(Int32 retryCount) : TimeSpan` #### interface IBackoffStrategy ##### `ComputeDelay(Int32 retryCount) : TimeSpan` #### interface ILockStatementProvider ##### `ProviderName : String` #### interface IOutboxMessage ##### `CorrelationId : String` ##### `CreatedAtUtc : DateTimeOffset` ##### `DeadLetteredAtUtc : Nullable` ##### `ErrorMessage : String` ##### `EventPayload : String` ##### `EventType : String` ##### `Id : Guid` ##### `LockedByInstanceId : String` ##### `LockedUntilUtc : Nullable` ##### `NextRetryAtUtc : Nullable` ##### `ProcessedAtUtc : Nullable` ##### `RetryCount : Int32` ##### `TenantId : String` #### interface IOutboxSerializer ##### `Deserialize(String eventType, String payload) : ISerializableEvent` ##### `GetEventTypeName(ISerializableEvent event) : String` ##### `Serialize(ISerializableEvent event) : String` #### interface IOutboxStore ##### `ClaimAsync(String instanceId, Int32 batchSize, TimeSpan lockDuration, CancellationToken cancellationToken) : Task>` ##### `DeleteDeadLetteredAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `DeleteProcessedAsync(TimeSpan olderThan, CancellationToken cancellationToken) : Task` ##### `GetDeadLettersAsync(Int32 batchSize, Int32 offset, CancellationToken cancellationToken) : Task>` ##### `MarkDeadLetteredAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `MarkFailedAsync(Guid messageId, String error, DateTimeOffset nextRetryAtUtc, CancellationToken cancellationToken) : Task` ##### `MarkProcessedAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `ReplayDeadLetterAsync(Guid messageId, CancellationToken cancellationToken) : Task` ##### `SaveAsync(IOutboxMessage message, CancellationToken cancellationToken) : Task` #### class JsonOutboxSerializer ##### `JsonOutboxSerializer()` ##### `Deserialize(String eventType, String payload) : ISerializableEvent` ##### `GetEventTypeName(ISerializableEvent event) : String` ##### `Serialize(ISerializableEvent event) : String` #### class OutboxEntityEventTracker A decorator over Entities.InMemoryEntityEventTracker that implements the two-phase transactional outbox pattern for domain event persistence. ##### `OutboxEntityEventTracker(InMemoryEntityEventTracker inner, OutboxEventRouter outboxRouter)` Initializes a new instance of Outbox.OutboxEntityEventTracker. - `inner`: The inner in-memory tracker that manages the entity collection. - `outboxRouter`: The outbox router used to buffer and persist events. - Throws: `System.ArgumentNullException` ##### `AddEntity(IBusinessEntity entity) : Void` ##### `EmitTransactionalEventsAsync(CancellationToken cancellationToken) : Task` ##### `PersistEventsAsync(CancellationToken cancellationToken) : Task` ##### `TrackedEntities : ICollection` #### class OutboxEventRouter An Producers.IEventRouter implementation that persists events to an outbox store before dispatching them to Producers.IEventProducer instances. ##### `OutboxEventRouter(IOutboxStore outboxStore, IOutboxSerializer serializer, IGuidGenerator guidGenerator, ITenantIdAccessor tenantIdAccessor, IServiceProvider serviceProvider, EventSubscriptionManager subscriptionManager, ILogger logger, IOptions options)` ##### `AddTransactionalEvent(ISerializableEvent serializableEvent) : Void` ##### `AddTransactionalEvents(IEnumerable serializableEvents) : Void` ##### `PersistBufferedEventsAsync(CancellationToken cancellationToken) : Task` Drains the in-memory buffer and writes each event as an Outbox.OutboxMessage to the Outbox.IOutboxStore. This must be called within the active database transaction (UnitOfWork Phase 1). - `cancellationToken`: A token to observe for cancellation requests. ##### `RouteEventsAsync(CancellationToken cancellationToken) : Task` Dispatches retained events that were persisted during OutboxEventRouter.PersistBufferedEventsAsync to registered Producers.IEventProducer instances, and marks each message processed on success. Events are dispatched from the in-memory retained list — no store reads are performed. This should be called post-commit (UnitOfWork Phase 3). If dispatch fails for a message, a warning is logged and the background processor will retry via IOutboxStore.ClaimAsync. - `cancellationToken`: A token to observe for cancellation requests. ##### `RouteEventsAsync(IEnumerable transactionalEvents, CancellationToken cancellationToken) : Task` #### class OutboxMessage ##### `OutboxMessage()` ##### `CorrelationId : String` ##### `CreatedAtUtc : DateTimeOffset` ##### `DeadLetteredAtUtc : Nullable` ##### `ErrorMessage : String` ##### `EventPayload : String` ##### `EventType : String` ##### `Id : Guid` ##### `LockedByInstanceId : String` ##### `LockedUntilUtc : Nullable` ##### `NextRetryAtUtc : Nullable` ##### `ProcessedAtUtc : Nullable` ##### `RetryCount : Int32` ##### `TenantId : String` #### class OutboxOptions ##### `OutboxOptions()` ##### `BackoffBaseDelay : TimeSpan` ##### `BackoffMaxDelay : TimeSpan` ##### `BackoffMultiplier : Double` ##### `BatchSize : Int32` ##### `CleanupAge : TimeSpan` ##### `CleanupInterval : TimeSpan` ##### `ImmediateDispatch : Boolean` Controls whether the unit of work attempts best-effort in-process dispatch of outbox events immediately after commit (Phase 3), in addition to persisting them for the background poller. ##### `InboxTableName : String` ##### `LockDuration : TimeSpan` ##### `MaxRetries : Int32` ##### `PollingInterval : TimeSpan` ##### `TableName : String` #### class OutboxProcessingService ##### `OutboxProcessingService(IServiceProvider serviceProvider, IOptions options, ILogger logger, IBackoffStrategy backoffStrategy)` ##### `ProcessBatchAsync(CancellationToken cancellationToken) : Task` #### class PostgreSqlLockStatementProvider ##### `PostgreSqlLockStatementProvider()` ##### `ProviderName : String` #### class SqlServerLockStatementProvider ##### `SqlServerLockStatementProvider()` ##### `ProviderName : String` ### Namespace RCommon.Persistence.Sagas #### interface ISagaStore ##### `DeleteAsync(TState state, CancellationToken ct) : Task` ##### `FindByCorrelationIdAsync(String correlationId, CancellationToken ct) : Task` ##### `GetByIdAsync(TKey id, CancellationToken ct) : Task` ##### `SaveAsync(TState state, CancellationToken ct) : Task` #### interface ISaga ##### `CompensateAsync(TState state, CancellationToken ct) : Task` ##### `HandleAsync(TEvent event, TState state, CancellationToken ct) : Task` #### class InMemorySagaStore ##### `InMemorySagaStore()` ##### `DeleteAsync(TState state, CancellationToken ct) : Task` ##### `FindByCorrelationIdAsync(String correlationId, CancellationToken ct) : Task` ##### `GetByIdAsync(TKey id, CancellationToken ct) : Task` ##### `SaveAsync(TState state, CancellationToken ct) : Task` #### class SagaOrchestrator ##### `CompensateAsync(TState state, CancellationToken ct) : Task` ##### `HandleAsync(TEvent event, TState state, CancellationToken ct) : Task` #### class SagaState ##### `CompletedAt : Nullable` ##### `CorrelationId : String` ##### `CurrentStep : String` ##### `FaultReason : String` ##### `Id : TKey` ##### `IsCompleted : Boolean` ##### `IsFaulted : Boolean` ##### `StartedAt : DateTimeOffset` ##### `Version : Int32` ### Namespace RCommon.Persistence.Sql #### interface IRDbConnection Represents an ADO.NET-based data store that extends Persistence.IDataStore to provide raw database connection access for SQL-mapper repositories. #### class RDbConnection Default implementation of Sql.IRDbConnection that creates ADO.NET Common.DbConnection instances using a configured Common.DbProviderFactory and connection string. ##### `RDbConnection(IOptions options)` ##### `GetDbConnection() : DbConnection` Creates and returns a new Common.DbConnection using the configured provider factory and connection string. - Returns: A new Common.DbConnection with its connection string set. - Throws: `RCommon.Persistence.Sql.RDbConnectionException` #### class RDbConnectionException Exception thrown when an Sql.RDbConnection encounters a configuration or connectivity error. ##### `RDbConnectionException(String message)` Initializes a new instance of the Sql.RDbConnectionException class with a specified error message. - `message`: A message describing the connection error. #### class RDbConnectionOptions Configuration options for Sql.RDbConnection, specifying the provider factory and connection string. ##### `RDbConnectionOptions()` Initializes a new instance of the Sql.RDbConnectionOptions class. ##### `ConnectionString : String` Gets or sets the database connection string. ##### `DbFactory : DbProviderFactory` Gets or sets the Common.DbProviderFactory used to create Common.DbConnection instances. ### Namespace RCommon.Persistence.Transactions #### class DefaultUnitOfWorkBuilder Default implementation of Transactions.IUnitOfWorkBuilder that registers Transactions.UnitOfWork and Transactions.UnitOfWorkFactory into the DI container. ##### `DefaultUnitOfWorkBuilder(IServiceCollection services)` Initializes a new instance of the Transactions.DefaultUnitOfWorkBuilder class and registers unit of work services as transient in the DI container. - `services`: The service collection to register services into. ##### `SetOptions(Action unitOfWorkOptions) : IUnitOfWorkBuilder` #### interface IUnitOfWork Defines a unit of work that manages a transaction scope around one or more persistence operations. ##### `AutoComplete : Boolean` Gets a value indicating whether the unit of work will automatically commit on disposal if no explicit commit or rollback was attempted. ##### `Commit() : Void` Commits the unit of work, completing the underlying transaction scope. - Throws: `System.ObjectDisposedException` - Throws: `RCommon.Persistence.Transactions.UnitOfWorkException` ##### `CommitAsync(CancellationToken cancellationToken) : Task` Asynchronously commits the unit of work, completing the underlying transaction scope and dispatching any tracked domain events after the transaction is fully committed. - `cancellationToken`: A token to monitor for cancellation requests. - Throws: `System.ObjectDisposedException` - Throws: `RCommon.Persistence.Transactions.UnitOfWorkException` ##### `IsolationLevel : IsolationLevel` Gets or sets the IUnitOfWork.IsolationLevel for the underlying transaction. ##### `State : UnitOfWorkState` Gets the current Transactions.UnitOfWorkState of this unit of work. ##### `TransactionId : Guid` Gets the unique identifier for this unit of work transaction. ##### `TransactionMode : TransactionMode` Gets or sets the IUnitOfWork.TransactionMode that determines how this unit of work participates in ambient transactions. #### interface IUnitOfWorkBuilder Builder interface for configuring unit of work services and default settings during application startup. ##### `SetOptions(Action unitOfWorkOptions) : IUnitOfWorkBuilder` #### interface IUnitOfWorkFactory Factory for creating Transactions.IUnitOfWork instances with configurable transaction settings. ##### `Create() : IUnitOfWork` Creates a new Transactions.IUnitOfWork with default transaction settings. - Returns: A new Transactions.IUnitOfWork instance. ##### `Create(TransactionMode transactionMode) : IUnitOfWork` Creates a new Transactions.IUnitOfWork with the specified transaction mode. - `transactionMode`: The Transactions.TransactionMode to use. - Returns: A new Transactions.IUnitOfWork instance. ##### `Create(TransactionMode transactionMode, IsolationLevel isolationLevel) : IUnitOfWork` Creates a new Transactions.IUnitOfWork with the specified transaction mode and isolation level. - `transactionMode`: The Transactions.TransactionMode to use. - `isolationLevel`: The Transactions.IsolationLevel for the transaction. - Returns: A new Transactions.IUnitOfWork instance. #### enum TransactionMode Defines the transaction mode when creating a new UnitOfWorkScope instance. ##### `Default : TransactionMode` Specifies that the UnitOfWorkScope should be created using default transaction mode. ##### `New : TransactionMode` Specifies that the scope should not participate in a parent UnitOfWorkScope's transaction, if one exists, and should start it's own transaction. ##### `Supress : TransactionMode` Specifies that the UnitOfWorkScope should not participate in a parent scope's transaction, and should not start a transaction of its own. ##### `value__ : Int32` #### class TransactionScopeHelper Helper class to create Transactions.TransactionScope instances. ##### `CreateScope(ILogger logger, IUnitOfWork unitOfWork) : TransactionScope` #### class UnitOfWork Default implementation of Transactions.IUnitOfWork that wraps a Transactions.TransactionScope to provide transactional consistency across persistence operations. ##### `UnitOfWork(ILogger logger, IGuidGenerator guidGenerator, IOptions unitOfWorkSettings, IEntityEventTracker eventTracker)` ##### `UnitOfWork(ILogger logger, IGuidGenerator guidGenerator, TransactionMode transactionMode, IsolationLevel isolationLevel, IEntityEventTracker eventTracker)` ##### `AutoComplete : Boolean` ##### `Commit() : Void` ##### `CommitAsync(CancellationToken cancellationToken) : Task` ##### `IsolationLevel : IsolationLevel` ##### `State : UnitOfWorkState` ##### `TransactionId : Guid` ##### `TransactionMode : TransactionMode` #### class UnitOfWorkException Exception thrown when a Transactions.IUnitOfWork operation fails, such as attempting to commit an already completed or rolled-back scope. ##### `UnitOfWorkException(String message)` Initializes a new instance of the Transactions.UnitOfWorkException class with a specified error message. - `message`: A message describing the unit of work failure. #### class UnitOfWorkFactory Default implementation of Transactions.IUnitOfWorkFactory that creates Transactions.IUnitOfWork instances from the DI container with optional transaction mode and isolation level overrides. ##### `UnitOfWorkFactory(IServiceProvider serviceProvider, IGuidGenerator guidGenerator)` Initializes a new instance of the Transactions.UnitOfWorkFactory class. - `serviceProvider`: The service provider used to resolve Transactions.IUnitOfWork instances. - `guidGenerator`: The GUID generator (passed through to resolved unit of work instances). - Throws: `System.ArgumentNullException` ##### `Create() : IUnitOfWork` ##### `Create(TransactionMode transactionMode) : IUnitOfWork` ##### `Create(TransactionMode transactionMode, IsolationLevel isolationLevel) : IUnitOfWork` #### class UnitOfWorkSettings Contains default settings for Transactions.UnitOfWork instances, including isolation level and auto-complete behavior. ##### `UnitOfWorkSettings()` Initializes a new instance of the Transactions.UnitOfWorkSettings class with IsolationLevel.ReadCommitted and auto-complete disabled. ##### `AutoCompleteScope : Boolean` Gets a boolean value indicating weather to auto complete UnitOfWorkScope instances. ##### `DefaultIsolation : IsolationLevel` Gets the default Transactions.IsolationLevel. #### enum UnitOfWorkState Represents the lifecycle state of a Transactions.UnitOfWork. ##### `CommitAttempted : UnitOfWorkState` A commit has been attempted on the unit of work. ##### `Completed : UnitOfWorkState` The unit of work has been successfully completed (committed). ##### `Created : UnitOfWorkState` The unit of work has been created but no commit or rollback has been attempted. ##### `Disposed : UnitOfWorkState` The unit of work has been disposed and can no longer be used. ##### `RolledBack : UnitOfWorkState` The unit of work has been rolled back. ##### `value__ : Int32` --- ## RCommon.Persistence.Caching ### Namespace RCommon.Persistence.Caching #### class IPersistenceBuilderExtensions Extension methods on RCommon.IPersistenceBuilder for registering persistence-level caching with a custom Caching.ICacheService factory. ##### `AddPersistenceCaching(IPersistenceBuilder builder, Func> cacheFactory) : Void` #### enum PersistenceCachingStrategy Defines the strategy used when caching persistence (repository) query results. ##### `Default : PersistenceCachingStrategy` The default persistence caching strategy. ##### `value__ : Int32` ### Namespace RCommon.Persistence.Caching.Crud #### class CachingGraphRepository Decorator around Crud.IGraphRepository`1 that adds cache-aware query overloads. Non-cached operations are delegated directly to the underlying repository. ##### `CachingGraphRepository(IGraphRepository repository, ICommonFactory cacheFactory)` ##### `AddAsync(TEntity entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DataStoreName : String` ##### `DeleteAsync(TEntity entity, CancellationToken token) : Task` ##### `DeleteAsync(TEntity entity, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `ElementType : Type` ##### `Expression : Expression` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` ##### `FindAsync(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindAsync(IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, Expression> expression, CancellationToken token) : Task>` ##### `FindQuery(ISpecification specification) : IQueryable` ##### `FindQuery(Expression> expression) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending) : IQueryable` ##### `FindQuery(IPagedSpecification specification) : IQueryable` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `GetEnumerator() : IEnumerator` ##### `Include(Expression> path) : IEagerLoadableQueryable` ##### `Provider : IQueryProvider` ##### `ThenInclude(Expression> path) : IEagerLoadableQueryable` ##### `Tracking : Boolean` ##### `UpdateAsync(TEntity entity, CancellationToken token) : Task` #### class CachingLinqRepository Decorator around Crud.IGraphRepository`1 (as an Crud.ILinqRepository`1 implementation) that adds cache-aware query overloads. Non-cached operations are delegated directly to the underlying repository. ##### `CachingLinqRepository(IGraphRepository repository, ICommonFactory cacheFactory)` ##### `AddAsync(TEntity entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DataStoreName : String` ##### `DeleteAsync(TEntity entity, CancellationToken token) : Task` ##### `DeleteAsync(TEntity entity, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `ElementType : Type` ##### `Expression : Expression` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` ##### `FindAsync(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindAsync(IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, Expression> expression, CancellationToken token) : Task>` ##### `FindQuery(ISpecification specification) : IQueryable` ##### `FindQuery(Expression> expression) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize) : IQueryable` ##### `FindQuery(Expression> expression, Expression> orderByExpression, Boolean orderByAscending) : IQueryable` ##### `FindQuery(IPagedSpecification specification) : IQueryable` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `GetEnumerator() : IEnumerator` ##### `Include(Expression> path) : IEagerLoadableQueryable` ##### `Provider : IQueryProvider` ##### `ThenInclude(Expression> path) : IEagerLoadableQueryable` ##### `UpdateAsync(TEntity entity, CancellationToken token) : Task` #### class CachingSqlMapperRepository Decorator around Crud.ISqlMapperRepository`1 that adds cache-aware query overloads. Non-cached operations are delegated directly to the underlying repository. ##### `CachingSqlMapperRepository(ISqlMapperRepository repository, ICommonFactory cacheFactory)` ##### `AddAsync(TEntity entity, CancellationToken token) : Task` ##### `AddRangeAsync(IEnumerable entities, CancellationToken token) : Task` ##### `AnyAsync(Expression> expression, CancellationToken token) : Task` ##### `AnyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DataStoreName : String` ##### `DeleteAsync(TEntity entity, CancellationToken token) : Task` ##### `DeleteAsync(TEntity entity, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, CancellationToken token) : Task` ##### `DeleteManyAsync(ISpecification specification, Boolean isSoftDelete, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, CancellationToken token) : Task` ##### `DeleteManyAsync(Expression> expression, Boolean isSoftDelete, CancellationToken token) : Task` ##### `FindAsync(ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Expression> expression, CancellationToken token) : Task>` ##### `FindAsync(Object primaryKey, CancellationToken token) : Task` ##### `FindAsync(Object cacheKey, ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, Expression> expression, CancellationToken token) : Task>` ##### `FindSingleOrDefaultAsync(Expression> expression, CancellationToken token) : Task` ##### `FindSingleOrDefaultAsync(ISpecification specification, CancellationToken token) : Task` ##### `GetCountAsync(ISpecification selectSpec, CancellationToken token) : Task` ##### `GetCountAsync(Expression> expression, CancellationToken token) : Task` ##### `TableName : String` ##### `UpdateAsync(TEntity entity, CancellationToken token) : Task` #### interface ICachingGraphRepository Extends Crud.IGraphRepository`1 with cache-aware query overloads that accept a cache key. ##### `FindAsync(Object cacheKey, Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, Expression> expression, CancellationToken token) : Task>` #### interface ICachingLinqRepository Extends Crud.ILinqRepository`1 with cache-aware query overloads that accept a cache key. ##### `FindAsync(Object cacheKey, Expression> expression, Expression> orderByExpression, Boolean orderByAscending, Int32 pageNumber, Int32 pageSize, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, IPagedSpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, Expression> expression, CancellationToken token) : Task>` #### interface ICachingSqlMapperRepository Extends Crud.ISqlMapperRepository`1 with cache-aware query overloads that accept a cache key. ##### `FindAsync(Object cacheKey, ISpecification specification, CancellationToken token) : Task>` ##### `FindAsync(Object cacheKey, Expression> expression, CancellationToken token) : Task>` --- ## RCommon.Persistence.Caching.MemoryCache ### Namespace RCommon.Persistence.Caching.MemoryCache #### class IPersistenceBuilderExtensions Extension methods on RCommon.IPersistenceBuilder for registering memory-based persistence caching (both in-process and distributed memory). ##### `AddDistributedMemoryPersistenceCaching(IPersistenceBuilder builder) : Void` Registers persistence caching backed by the MemoryCache.DistributedMemoryCacheService (an in-memory distributed cache), including all caching repository decorators and the strategy-based cache factory. - `builder`: The persistence builder. ##### `AddInMemoryPersistenceCaching(IPersistenceBuilder builder) : Void` Registers persistence caching backed by the in-process MemoryCache.InMemoryCacheService, including all caching repository decorators and the strategy-based cache factory. - `builder`: The persistence builder. --- ## RCommon.Persistence.Caching.RedisCache ### Namespace RCommon.Persistence.Caching.RedisCache #### class IPersistenceBuilderExtensions Extension methods on RCommon.IPersistenceBuilder for registering Redis-backed persistence caching. ##### `AddRedisPersistenceCaching(IPersistenceBuilder builder) : Void` Registers persistence caching backed by the RedisCache.RedisCacheService, including all caching repository decorators and the strategy-based cache factory. - `builder`: The persistence builder. --- ## RCommon.RedisCache ### Namespace RCommon.RedisCache #### interface IRedisCachingBuilder Marker interface for configuring Redis-backed distributed caching. #### class IRedisCachingBuilderExtensions Extension methods for RedisCache.IRedisCachingBuilder that configure Redis cache options and expression caching. ##### `CacheDynamicallyCompiledExpressions(IRedisCachingBuilder builder) : IRedisCachingBuilder` This greatly improves performance across various areas of RCommon which use generics and reflection heavily to compile expressions and lambdas - `builder`: Builder - Returns: Same builder to allow chaining ##### `Configure(IRedisCachingBuilder builder, Action actions) : IRedisCachingBuilder` #### class RedisCacheService A wrapper for Redis data caching implemented through the Distributed.IDistributedCache abstraction (backed by StackExchange.Redis). ##### `RedisCacheService(IDistributedCache distributedCache, IJsonSerializer jsonSerializer)` Initializes a new instance of the RedisCache.RedisCacheService class. - `distributedCache`: The underlying distributed cache implementation (Redis). - `jsonSerializer`: The JSON serializer used to serialize/deserialize cached values. ##### `GetOrCreate(Object key, Func data) : TData` ##### `GetOrCreateAsync(Object key, Func data) : Task` #### class RedisCachingBuilder Builder for configuring Redis-backed distributed caching using the StackExchange.Redis provider. ##### `RedisCachingBuilder(IRCommonBuilder builder)` Initializes a new instance of the RedisCache.RedisCachingBuilder class. - `builder`: The RCommon builder whose DependencyInjection.IServiceCollection is used for service registration. ##### `Services : IServiceCollection` --- ## RCommon.Security ### Namespace RCommon #### class SecurityConfigurationExtensions Extension methods for RCommon.IRCommonBuilder that register security-related services such as claims-based principal access, current user, and current client abstractions. ##### `WithClaimsAndPrincipalAccessor(IRCommonBuilder config) : IRCommonBuilder` Registers the default claims and principal accessor services into the dependency injection container. This includes Claims.ICurrentPrincipalAccessor, Clients.ICurrentClient, and Users.ICurrentUser. - `config`: The RCommon builder to configure. - Returns: The same RCommon.IRCommonBuilder instance for fluent chaining. ### Namespace RCommon.Security #### class ClaimsIdentityExtensions Extension methods for Claims.ClaimsPrincipal, Principal.IIdentity, and Claims.ClaimsIdentity that simplify extracting well-known claim values and managing claims collections. ##### `AddIdentityIfNotContains(ClaimsPrincipal principal, ClaimsIdentity identity) : ClaimsPrincipal` Adds a Claims.ClaimsIdentity to the principal only if no identity with the same ClaimsIdentity.AuthenticationType already exists (case-insensitive comparison). - `principal`: The principal to add the identity to. - `identity`: The identity to add. - Returns: The same Claims.ClaimsPrincipal instance for fluent chaining. ##### `AddIfNotContains(ClaimsIdentity claimsIdentity, Claim claim) : ClaimsIdentity` Adds a claim to the identity only if no claim with the same type already exists (case-insensitive comparison). - `claimsIdentity`: The identity to add the claim to. - `claim`: The claim to add. - Returns: The same Claims.ClaimsIdentity instance for fluent chaining. ##### `AddOrReplace(ClaimsIdentity claimsIdentity, Claim claim) : ClaimsIdentity` Removes all existing claims of the same type and adds the new claim. - `claimsIdentity`: The identity to modify. - `claim`: The claim to set, replacing any existing claims of the same type. - Returns: The same Claims.ClaimsIdentity instance for fluent chaining. ##### `FindClientId(ClaimsPrincipal principal) : String` Extracts the client identifier from the principal's claims. - `principal`: The claims principal to search. - Returns: The client ID string, or null if the claim is missing or empty. ##### `FindClientId(IIdentity identity) : String` Extracts the client identifier from the identity's claims. - `identity`: The identity to search. Must be castable to Claims.ClaimsIdentity. - Returns: The client ID string, or null if the claim is missing or empty. ##### `FindTenantId(ClaimsPrincipal principal) : String` Extracts the tenant identifier from the principal's claims as a raw string value. - `principal`: The claims principal to search. - Returns: The tenant ID string, or null if the claim is missing or empty. ##### `FindTenantId(IIdentity identity) : String` Extracts the tenant identifier from the identity's claims as a raw string value. - `identity`: The identity to search. Must be castable to Claims.ClaimsIdentity. - Returns: The tenant ID string, or null if the claim is missing or empty. ##### `FindUserId(ClaimsPrincipal principal) : String` Extracts the user identifier from the principal's claims as a raw string value. - `principal`: The claims principal to search. - Returns: The user ID string, or null if the claim is missing or empty. ##### `FindUserId(IIdentity identity) : String` Extracts the user identifier from the identity's claims as a raw string value. - `identity`: The identity to search. Must be castable to Claims.ClaimsIdentity. - Returns: The user ID string, or null if the claim is missing or empty. ### Namespace RCommon.Security.Authorization #### class AuthorizationException This exception is thrown on an unauthorized request. ##### `AuthorizationException()` Creates a new Authorization.AuthorizationException object. ##### `AuthorizationException(String message)` Creates a new Authorization.AuthorizationException object. - `message`: Exception message ##### `AuthorizationException(String message, Exception innerException)` Creates a new Authorization.AuthorizationException object. - `message`: Exception message - `innerException`: Inner exception ##### `AuthorizationException(String message, String code, Exception innerException)` Creates a new Authorization.AuthorizationException object. - `message`: Exception message - `code`: Exception code - `innerException`: Inner exception ##### `Code : String` Error code. ##### `LogLevel : LogLevel` Severity of the exception. Default: Warn. ##### `WithData(String name, Object value) : AuthorizationException` Adds a key/value pair to the exception's Exception.Data dictionary and returns the current instance for fluent chaining. - `name`: The key to store in the data dictionary. - `value`: The value associated with the key. - Returns: The current Authorization.AuthorizationException instance. ### Namespace RCommon.Security.Claims #### class ClaimTypesConst Provides claim type URI constants used throughout the security subsystem. Call ClaimTypesConst.Configure once at startup to override defaults. After configuration (or first property access), values are frozen. ##### `ClientId : String` ##### `Configure(Action configure) : Void` ##### `Email : String` ##### `Name : String` ##### `Role : String` ##### `SurName : String` ##### `TenantId : String` ##### `UserId : String` ##### `UserName : String` #### class ClaimTypesOptions Configurable options for claim type URI mappings. Set properties to match the claim types issued by your identity provider. ##### `ClaimTypesOptions()` ##### `ClientId : String` ##### `Email : String` ##### `Name : String` ##### `Role : String` ##### `SurName : String` ##### `TenantId : String` ##### `UserId : String` ##### `UserName : String` #### class ClaimsTenantIdAccessor Claims-based implementation of Claims.ITenantIdAccessor that resolves the current tenant identifier from the authenticated user's claims via Claims.ICurrentPrincipalAccessor. ##### `ClaimsTenantIdAccessor(ICurrentPrincipalAccessor principalAccessor)` Initializes a new instance of the Claims.ClaimsTenantIdAccessor class. - `principalAccessor`: The principal accessor used to retrieve the current claims principal. - Throws: `System.ArgumentNullException` ##### `GetTenantId() : String` #### class CurrentPrincipalAccessorBase Abstract base class for accessing and temporarily replacing the current Claims.ClaimsPrincipal. Uses Threading.AsyncLocal`1 to maintain an override principal that flows across async contexts. ##### `Change(ClaimsPrincipal principal) : IDisposable` ##### `Principal : ClaimsPrincipal` #### class CurrentPrincipalAccessorExtensions Convenience extension methods for Claims.ICurrentPrincipalAccessor that allow changing the current principal from a single Claims.Claim, a collection of claims, or a Claims.ClaimsIdentity. ##### `Change(ICurrentPrincipalAccessor currentPrincipalAccessor, Claim claim) : IDisposable` Temporarily replaces the current principal with one containing the specified claim. - `currentPrincipalAccessor`: The principal accessor to change. - `claim`: The claim to include in the new principal. - Returns: An System.IDisposable that restores the previous principal on disposal. ##### `Change(ICurrentPrincipalAccessor currentPrincipalAccessor, IEnumerable claims) : IDisposable` ##### `Change(ICurrentPrincipalAccessor currentPrincipalAccessor, ClaimsIdentity claimsIdentity) : IDisposable` Temporarily replaces the current principal with one wrapping the specified claimsIdentity. - `currentPrincipalAccessor`: The principal accessor to change. - `claimsIdentity`: The identity to wrap in a new Claims.ClaimsPrincipal. - Returns: An System.IDisposable that restores the previous principal on disposal. #### interface ICurrentPrincipalAccessor Provides access to the current Claims.ClaimsPrincipal and allows temporarily replacing it within a scoped context. ##### `Change(ClaimsPrincipal principal) : IDisposable` Temporarily replaces the current principal with the specified principal. - `principal`: The new principal to set as current. - Returns: An System.IDisposable that restores the previous principal when disposed. ##### `Principal : ClaimsPrincipal` Gets the current Claims.ClaimsPrincipal, or null if none is available. #### interface ITenantIdAccessor Provides access to the current tenant identifier at runtime. Repository implementations use this to automatically filter queries and stamp new entities with the current tenant. ##### `GetTenantId() : String` Gets the current tenant identifier, or null if no tenant context is available. When null or empty, tenant filtering is bypassed entirely. #### class NullTenantIdAccessor Default implementation of Claims.ITenantIdAccessor that always returns null. Registered automatically when persistence is configured. When multitenancy is not enabled, this ensures all tenant-related filtering is bypassed without requiring conditional logic. ##### `NullTenantIdAccessor()` ##### `GetTenantId() : String` #### class TenantScope Ambient, scoped bypass for tenant-based repository filtering and stamping. While a scope returned by TenantScope.Bypass is active, any Claims.ITenantIdAccessor wrapped with Claims.TenantScopeAwareTenantIdAccessor resolves to null, which every repository already treats as "skip tenant filtering / skip stamping" per ITenantIdAccessor.GetTenantId's existing contract. ##### `Bypass() : IDisposable` Suspends tenant scoping for the returned scope's lifetime, including across async continuations. Always dispose the returned handle (a using block is recommended) -- if it is never disposed, the bypass remains active for the rest of the current logical call context. - Returns: An System.IDisposable that restores the previous bypass state when disposed. ##### `IsBypassed : Boolean` Gets whether a bypass scope is currently active for this logical call context. #### class TenantScopeAwareTenantIdAccessor Decorates an Claims.ITenantIdAccessor so that TenantScope.Bypass suspends its resolution for the scope's lifetime. RCommon wraps its own Claims.ClaimsTenantIdAccessor and Finbuckle's tenant accessor with this automatically; wrap a custom Claims.ITenantIdAccessor implementation with this type at your own registration site to opt into the same bypass support. ##### `TenantScopeAwareTenantIdAccessor(ITenantIdAccessor inner)` Initializes a new instance of Claims.TenantScopeAwareTenantIdAccessor wrapping inner. - `inner`: The accessor to delegate to when no bypass scope is active. - Throws: `System.ArgumentNullException` ##### `GetTenantId() : String` #### class ThreadCurrentPrincipalAccessor An Claims.ICurrentPrincipalAccessor implementation that retrieves the default principal from Thread.CurrentPrincipal. ##### `ThreadCurrentPrincipalAccessor()` ### Namespace RCommon.Security.Clients #### class CurrentClient Default implementation of Clients.ICurrentClient that resolves the client identity from the current ClaimsPrincipal via Claims.ICurrentPrincipalAccessor. ##### `CurrentClient(ICurrentPrincipalAccessor principalAccessor)` Initializes a new instance of the Clients.CurrentClient class. - `principalAccessor`: The accessor used to retrieve the current claims principal. ##### `Id : String` ##### `IsAuthenticated : Boolean` #### interface ICurrentClient Represents the currently authenticated client (e.g., an OAuth client application) in a multi-client environment. ##### `Id : String` Gets the unique identifier of the current client, derived from the ClaimTypesConst.ClientId claim. Returns null if no client identity is present. ##### `IsAuthenticated : Boolean` Gets a value indicating whether the current request has an authenticated client identity. ### Namespace RCommon.Security.Users #### class CurrentUser Default implementation of Users.ICurrentUser that resolves user information from the current Claims.ClaimsPrincipal via Claims.ICurrentPrincipalAccessor. ##### `CurrentUser(ICurrentPrincipalAccessor principalAccessor)` Initializes a new instance of the Users.CurrentUser class. - `principalAccessor`: The accessor used to retrieve the current claims principal. ##### `FindClaim(String claimType) : Claim` ##### `FindClaims(String claimType) : Claim[]` ##### `GetAllClaims() : Claim[]` ##### `Id : String` ##### `IsAuthenticated : Boolean` ##### `Roles : String[]` ##### `TenantId : String` #### class CurrentUserExtensions Convenience extension methods for Users.ICurrentUser that simplify claim value retrieval and provide strongly-typed access to user identity properties. ##### `FindClaimValue(ICurrentUser currentUser, String claimType) : String` Finds a claim of the specified type and returns its string value. - `currentUser`: The current user instance. - `claimType`: The claim type URI to search for. - Returns: The claim value as a string, or null if the claim is not found. ##### `GetId(ICurrentUser currentUser) : String` Gets the current user's ID, asserting that it is not null. - `currentUser`: The current user instance. - Returns: The user's string identifier. - Throws: `System.InvalidOperationException` #### interface ICurrentUser Represents the currently authenticated user, providing access to identity properties and claims. ##### `FindClaim(String claimType) : Claim` Finds the first claim matching the specified claimType. - `claimType`: The claim type URI to search for. - Returns: The matching Claims.Claim, or null if not found. ##### `FindClaims(String claimType) : Claim[]` Finds all claims matching the specified claimType. - `claimType`: The claim type URI to search for. - Returns: An array of matching claims, or an empty array if none are found. ##### `GetAllClaims() : Claim[]` Gets all claims associated with the current user. - Returns: An array of all claims, or an empty array if the user has no claims. ##### `Id : String` Gets the unique identifier of the current user, or null if no user is authenticated. ##### `IsAuthenticated : Boolean` Gets a value indicating whether the current user is authenticated, as reported by the underlying Principal.IIdentity. ##### `Roles : String[]` Gets the distinct set of role names assigned to the current user. ##### `TenantId : String` Gets the tenant identifier of the current user, or null if no tenant claim is present. --- ## RCommon.SendGrid ### Namespace RCommon #### class SendGridEmailingConfigurationExtensions Extension methods for RCommon.IRCommonBuilder that register SendGrid-based email services. ##### `WithSendGridEmailServices(IRCommonBuilder config, Action emailSettings) : IRCommonBuilder` ### Namespace RCommon.Emailing.SendGrid #### class SendGridEmailService Implementation of Emailing.IEmailService that sends email through the SendGrid API. ##### `SendGridEmailService(IOptions settings, ILogger logger)` ##### `EmailSent : EventHandler` ##### `SendEmail(MailMessage message) : Void` ##### `SendEmailAsync(MailMessage message, CancellationToken cancellationToken) : Task` #### class SendGridEmailSettings Configuration settings for the SendGrid.SendGridEmailService. Typically bound from an application configuration section (e.g., appsettings.json). ##### `SendGridEmailSettings()` Initializes a new instance of the SendGrid.SendGridEmailSettings class. ##### `FromEmailDefault : String` Gets or sets the default sender email address used when no explicit "From" address is specified. ##### `FromNameDefault : String` Gets or sets the default sender display name used when no explicit "From" name is specified. ##### `SendGridApiKey : String` Gets or sets the SendGrid API key used to authenticate with the SendGrid service. --- ## RCommon.Stateless ### Namespace RCommon #### class StatelessBuilderExtensions Provides extension methods on RCommon.IRCommonBuilder for registering the Stateless state machine adapter into the RCommon configuration pipeline. ##### `WithStatelessStateMachine(IRCommonBuilder builder) : IRCommonBuilder` Registers the Stateless library as the StateMachines.IStateMachineConfigurator`2 implementation, enabling state machine support throughout the application. - `builder`: The RCommon builder instance. - Returns: The RCommon.IRCommonBuilder for further chaining. ### Namespace RCommon.Stateless #### class StatelessConfigurator Implements StateMachines.IStateMachineConfigurator`2 using the Stateless library. ##### `StatelessConfigurator()` ##### `Build(TState initialState) : IStateMachine` ##### `ForState(TState state) : IStateConfigurator` #### class StatelessStateMachine Wraps a Stateless.StateMachine to implement the RCommon StateMachines.IStateMachine`2 abstraction. ##### `CanFire(TTrigger trigger) : Boolean` ##### `CurrentState : TState` ##### `FireAsync(TTrigger trigger, CancellationToken cancellationToken) : Task` ##### `FireAsync(TTrigger trigger, TData data, CancellationToken cancellationToken) : Task` ##### `PermittedTriggers : IEnumerable` --- ## RCommon.SystemTextJson ### Namespace RCommon.SystemTextJson #### interface ITextJsonBuilder Builder interface for configuring JSON serialization using the System.Text.Json library. #### class ITextJsonBuilderExtensions Provides extension methods for SystemTextJson.ITextJsonBuilder to configure System.Text.Json settings. ##### `Configure(ITextJsonBuilder builder, Action options) : ITextJsonBuilder` #### class JsonByteEnumConverter A custom Serialization.JsonConverter`1 that serializes enum values as their underlying System.Byte numeric representation and deserializes from string names. ##### `JsonByteEnumConverter()` ##### `Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) : T` Reads a JSON string token and parses it into the corresponding T enum value. - `reader`: The UTF-8 JSON reader. - `typeToConvert`: The target enum type. - `options`: The serializer options. - Returns: The parsed enum value of type T. ##### `Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) : Void` Writes the enum value as its System.Byte numeric representation. - `writer`: The UTF-8 JSON writer. - `value`: The enum value to serialize. - `options`: The serializer options. #### class JsonIntEnumConverter A custom Serialization.JsonConverter`1 that serializes enum values as their underlying System.Int32 numeric representation and deserializes from string names. ##### `JsonIntEnumConverter()` ##### `Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) : T` Reads a JSON string token and parses it into the corresponding T enum value. - `reader`: The UTF-8 JSON reader. - `typeToConvert`: The target enum type. - `options`: The serializer options. - Returns: The parsed enum value of type T. ##### `Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) : Void` Writes the enum value as its System.Int32 numeric representation. - `writer`: The UTF-8 JSON writer. - `value`: The enum value to serialize. - `options`: The serializer options. #### class TextJsonBuilder Default implementation of SystemTextJson.ITextJsonBuilder that registers the System.Text.Json-based SystemTextJson.TextJsonSerializer into the DI container. ##### `TextJsonBuilder(IRCommonBuilder builder)` Initializes a new instance of SystemTextJson.TextJsonBuilder and registers JSON serialization services. - `builder`: The RCommon builder providing access to the DependencyInjection.IServiceCollection. ##### `Services : IServiceCollection` #### class TextJsonSerializer Implements Json.IJsonSerializer using the System.Text.Json library. Supports per-call overrides for camel-case naming and indented formatting through Json.JsonSerializeOptions and Json.JsonDeserializeOptions. ##### `TextJsonSerializer(IOptions options)` ##### `Deserialize(String json, JsonDeserializeOptions options) : T` ##### `Deserialize(String json, Type type, JsonDeserializeOptions options) : Object` ##### `Serialize(Object obj, JsonSerializeOptions options) : String` ##### `Serialize(Object obj, Type type, JsonSerializeOptions options) : String` --- ## RCommon.Web ### Namespace RCommon #### class WebConfigurationExtensions Extension methods for RCommon.IRCommonBuilder that register web-specific security services using the HTTP context to access the current Claims.ClaimsPrincipal. ##### `WithClaimsAndPrincipalAccessorForWeb(IRCommonBuilder config) : IRCommonBuilder` Registers claims and principal accessor services for ASP.NET Core web applications. Uses Security.HttpContextCurrentPrincipalAccessor to resolve the current user from HttpContext.User instead of Thread.CurrentPrincipal. - `config`: The RCommon builder to configure. - Returns: The same RCommon.IRCommonBuilder instance for fluent chaining. ### Namespace RCommon.Web.Security #### class HttpContextCurrentPrincipalAccessor An Claims.ICurrentPrincipalAccessor implementation that retrieves the default principal from the current HTTP context via Http.IHttpContextAccessor. ##### `HttpContextCurrentPrincipalAccessor(IHttpContextAccessor httpContextAccessor)` Initializes a new instance of the Security.HttpContextCurrentPrincipalAccessor class. - `httpContextAccessor`: The HTTP context accessor used to retrieve the current request context. --- ## RCommon.Wolverine ### Namespace RCommon #### class WolverineEventHandlingBuilderExtensions Extension methods for configuring Wolverine event handling within the RCommon builder pipeline. ##### `AddSubscriber(IWolverineEventHandlingBuilder builder) : Void` Registers a subscriber for a specific event type and records the event-to-producer subscription for routing. - `builder`: The Wolverine event handling builder. ##### `AddSubscriber(IWolverineEventHandlingBuilder builder, Func getSubscriber) : Void` ### Namespace RCommon.MassTransit.Subscribers #### interface IWolverineEventHandler Non-generic marker interface for Wolverine event handlers within the RCommon framework. #### interface IWolverineEventHandler Generic interface for Wolverine event handlers that process a specific distributed event type. ##### `HandleAsync(TDistributedEvent distributedEvent, CancellationToken cancellationToken) : Task` Handles the distributed event asynchronously. - `distributedEvent`: The event to handle. - `cancellationToken`: Optional cancellation token. - Returns: A task representing the asynchronous operation. #### class WolverineEventHandler Wolverine handler that bridges Wolverine message handling to the RCommon Subscribers.ISubscriber`1 abstraction. Implements both Subscribers.IWolverineEventHandler`1 and Wolverine's Wolverine.IWolverineHandler. ##### `WolverineEventHandler(ISubscriber subscriber, ILogger> logger)` ##### `HandleAsync(TEvent event, CancellationToken cancellationToken) : Task` ### Namespace RCommon.Wolverine #### interface IWolverineEventHandlingBuilder Builder interface for configuring Wolverine-based event handling within the RCommon framework. Extends EventHandling.IEventHandlingBuilder to provide Wolverine-specific event subscription capabilities. #### class WolverineEventHandlingBuilder Default implementation of Wolverine.IWolverineEventHandlingBuilder that configures Wolverine event handling services through the RCommon builder pipeline. ##### `WolverineEventHandlingBuilder(IRCommonBuilder builder)` Initializes a new instance of Wolverine.WolverineEventHandlingBuilder using the provided RCommon builder. - `builder`: The RCommon.IRCommonBuilder whose service collection is used for dependency registration. ##### `Services : IServiceCollection` ### Namespace RCommon.Wolverine.Producers #### class PublishWithWolverineEventProducer An Producers.IEventProducer implementation that publishes events to all subscribed handlers using Wolverine's IMessageBus.PublishAsync method (fan-out pattern). ##### `PublishWithWolverineEventProducer(IMessageBus messageBus, ILogger logger, IServiceProvider serviceProvider, EventSubscriptionManager subscriptionManager)` ##### `ProduceEventAsync(T event, CancellationToken cancellationToken) : Task` #### class SendWithWolverineEventProducer An Producers.IEventProducer implementation that sends events to a single handler endpoint using Wolverine's IMessageBus.SendAsync method (point-to-point pattern). ##### `SendWithWolverineEventProducer(IMessageBus messageBus, ILogger logger, IServiceProvider serviceProvider, EventSubscriptionManager subscriptionManager)` ##### `ProduceEventAsync(T event, CancellationToken cancellationToken) : Task` --- ## RCommon.Wolverine.Outbox ### Namespace RCommon #### class WolverineOutboxBuilderExtensions ##### `AddOutbox(IWolverineEventHandlingBuilder builder, Action configure) : IWolverineEventHandlingBuilder` ### Namespace RCommon.Wolverine.Outbox #### interface IWolverineOutboxBuilder ##### `UseEntityFrameworkCoreTransactions() : IWolverineOutboxBuilder` #### class WolverineOutboxBuilder ##### `WolverineOutboxBuilder(WolverineOptions wolverineOptions)` ##### `UseEntityFrameworkCoreTransactions() : IWolverineOutboxBuilder`