Moved `BodyQueryBehavior` and `HeaderQueryBehavior` from
`ReC.Application.RecActions.Behaviors` to
`ReC.Application.Common.Behaviors` to reflect their broader
applicability. Updated `DependencyInjection.cs` to use the new
namespace. This reorganization improves code structure and
maintainability.
Added `HeaderQueryBehavior<TRecAction>` to handle header query
processing in the MediatR pipeline. Updated the `DependencyInjection`
class to register `HeaderQueryBehavior<>` alongside
`BodyQueryBehavior<>` in the MediatR configuration. The new behavior
currently throws a `NotImplementedException` as its logic is pending
implementation.
Introduced the `BodyQueryBehavior<TRecAction>` class, which implements the `IPipelineBehavior` interface to handle actions of type `RecActionDto`. The behavior is currently unimplemented and throws a `NotImplementedException`.
Updated the `DependencyInjection` class to register `BodyQueryBehavior<>` as an open generic pipeline behavior in MediatR. Added necessary `using` directives in both `DependencyInjection.cs` and `BodyQueryBehavior.cs` to support the new behavior.
Organized the `DependencyInjection` class into regions for better code structure: `Required Services`, `Configuration`, `LuckyPennySoftwareLicenseKey`, and `ConfigureRecActions`.
Added `_requiredServices` dictionary to track the configuration status of required services. Updated `LuckyPennySoftwareLicenseKey` to include a null check before marking it as configured.
Moved `_configActions` to the `Configuration` region and added `ApplyConfigurations` to process queued configuration actions.
Enhanced `ConfigureRecActions` to prevent duplicate configurations by throwing an `InvalidOperationException` if already configured.
These changes improve code readability, maintainability, and robustness.
Added `EnsureRequiredServices` to validate required services
in `ConfigurationOptions`, throwing an exception if any are
missing. Introduced `_requiredServices` dictionary to track
configuration status for `ConfigureRecActions` and
`LuckyPennySoftwareLicenseKey`. Updated property and methods
to mark services as configured. Integrated validation into
`AddRecServices` to enforce proper setup.
Updated `DependencyInjection.cs` to include support for
`ConfigurationOptions`, enabling queued configuration actions
and the ability to configure `RecActionOptions` via delegates
or `IConfiguration`. Added `LuckyPennySoftwareLicenseKey`
property to `ConfigurationOptions` and integrated it into
`AddAutoMapper` setup. Introduced `ApplyConfigurations`
method to process queued actions. Updated `using` directives
to include necessary namespaces.
Added a call to `services.AddHttpClient();` in the `DependencyInjection` class within `DependencyInjection.cs`. This change registers the `HttpClient` service in the dependency injection container, allowing the application to use managed `HttpClient` instances.
Updated the `LuckyPennySoftwareLicenseKey` property in the
`ConfigurationOptions` class to allow null values by changing
it from a non-nullable string with a default value of an empty
string to a nullable string (`string?`). This change enables
explicit representation of the absence of a license key using
`null` instead of an empty string.
Introduced a new `DependencyInjection` class in the `ReC.Application` namespace to streamline service registration.
- Added `AddRecServices` extension method for `IServiceCollection` to configure AutoMapper and MediatR with assembly scanning.
- Included `ConfigurationOptions` class to allow configuration of a `LuckyPennySoftwareLicenseKey`.
- Added `using` directives for `Microsoft.Extensions.DependencyInjection` and `System.Reflection` to support dependency injection and assembly scanning.