Updated <Version>, <AssemblyVersion>, <FileVersion>, and <InformationalVersion> fields from 1.0.3-beta to 2.0.0-beta to reflect a major version change, indicating significant updates or breaking changes in the project.
Changed EndpointAuthType in RecActionViewDto from nullable to non-nullable and set its default value to EndpointAuthType.NoAuth to ensure it always has a valid value.
Refactored InsertActionProcedure to the RecActions.Commands namespace and updated its usings to import InsertObjectProcedure. Added missing using for RecActions.Commands in InsertObjectProcedure.cs. These changes improve code organization and clarify command responsibilities.
Changed TypeId from byte? to RestType? in InsertActionProcedure for stronger typing. Updated InsertObjectProcedureHandler to cast RestType to byte? when creating SQL parameters. Added using directive for ReC.Domain.Constants to support the new enum type.
Clarify intent by renaming SqlExceptionNumber to BadRequestSqlExceptionNumber in both configuration and code. This makes it explicit that these SQL exception numbers are mapped to HTTP 400 Bad Request errors. All relevant usages and settings have been updated accordingly.
Updated appsettings.json to include 50000 in the SqlExceptionNumber array, allowing the application to recognize and handle SQL exceptions with this number in addition to existing ones. This change can be applied at runtime without requiring a restart.
Refactored Delete, Insert, and Update procedure handlers to inject IOptionsMonitor<SqlExceptionOptions> instead of SqlExceptionOptions, enabling dynamic configuration updates. Updated all references to use CurrentValue. Added necessary using directives and cleaned up redundant usings in InsertObjectProcedure.cs.
Removed the "ErrorMessages" wrapper from the SqlException section,
placing "SqlExceptionNumber" directly under "SqlException".
No changes to the exception numbers themselves. Improved
readability and clarity of the configuration.
Wrap stored procedure execution in try-catch to handle SqlException.
Throw BadRequestException for configured SQL error numbers.
Update constructor to accept SqlExceptionOptions.
Add necessary using directives for new exception handling.
Replaced the detailed error message for insert failures with only the original exception message from SqlException, removing extra guidance about referenced entities.
Refactored DeleteObjectProcedureHandler to inject SqlExceptionOptions and wrap stored procedure execution in a try-catch block. Added logic to throw custom exceptions (DeleteObjectFailedException, BadRequestException) based on result codes and SQL exception numbers, enhancing robustness and configurability of error handling.
Added ConfigureSqlException methods to DependencyInjection for flexible SQL exception handling configuration. Updated RecApplicationTestBase to use new options. Bumped DigitalData.Core.Exceptions to v1.1.1.
Wrap SQL execution in try-catch and inject SqlExceptionOptions.
Throw BadRequestException with a clear message when insert fails due to missing referenced entities, based on SqlException number. Other SQL exceptions are rethrown. This provides better feedback for foreign key/reference errors.
Updated Program.cs to configure SQL exception handling using the new "SqlException" section in appsettings.json. Renamed "SqlExceptionTranslator" to "SqlException" and added error message mappings for specific SQL exception numbers to enable custom exception translation.
Simplify SQL exception tracking by replacing error message mappings
with a list of relevant error numbers in appsettings.json. Remove
custom error message logic and related classes, introducing
SqlExceptionOptions to hold tracked error codes.
Introduce SqlExceptionTranslator section in appsettings.json to map common SQL error codes to user-friendly messages. Add SqlExceptionTranslatorOptions class to manage error code/message mapping and support configuration binding.
Introduced SqlExceptionTranslator and ISqlExceptionTranslator to translate SQL exceptions into user-friendly error messages for bad request scenarios. Uses configurable options to identify relevant error numbers and format messages with templates.
Removed IConfiguration from ResultController constructor, now only using IMediator. Added logging for BadRequestException inner exceptions in ExceptionHandlingMiddleware for improved error diagnostics.
Removed API endpoints for invoking, retrieving, and deleting RecActions and Results associated with fake/test profiles in RecActionController and ResultController. Only standard CRUD operations for real profiles are now exposed.
Changed the Post method to return CreatedAtAction, providing a Location header linking to the new profile resource, in line with RESTful best practices.
Wrap InsertActionProcedure_runs_via_mediator in a try-catch block to handle SQL exceptions for duplicate key and foreign key violations, marking the test as passed with explanatory messages. Also, add EndpointId to the test data and improve assertion clarity. This increases test robustness against common DB constraint issues in integration testing.
Previously, tests asserted that procedure results were exactly 0.
Now, assertions require only that results are not the default int
value, making the tests more flexible to non-zero outcomes.
Updated DeleteObjectProcedureHandler and UpdateObjectProcedureHandler to declare, initialize, and select the @RC variable in their SQL command strings. This ensures the stored procedure return code is explicitly captured and returned by the query.
Updated ProfileQueryTests, RecActionQueryTests, and ResultQueryTests to catch NotFoundException and pass tests with an explanatory message when test data is missing or entities are not found. This improves test robustness and reduces false negatives due to unavailable test data. Also renamed a test in ResultQueryTests to reflect the new behavior.
Mapped ProfileView to the VWREC_PROFILE view in the dbo schema.
Configured primary key and property-to-column mappings for all
relevant fields, enabling read access to profile data via EF Core.
Added ReC.Tests project with integration tests for stored procedure commands and queries via MediatR, covering endpoints, actions, results, and profiles. Introduced a test base for DI/configuration, helper for private property access, and updated the solution to include the new test suite. Tests use NUnit and cover both positive and negative scenarios.
Added new ReC.Abstractions.Application project targeting .NET 8.0, with implicit usings and nullable enabled. Updated solution file to include the project under the "core" folder and configured build settings for Debug and Release.
BaseCrudApi is now defined as BaseCrudApi<TCreate, TUpdate, TDelete>,
with each CRUD method using its respective type parameter. This
improves type safety and clarity for API payloads. Method signatures
and XML documentation have been updated accordingly.
Introduce BaseCrudApi to encapsulate common CRUD logic for API resource classes. Refactor CommonApi, EndpointAuthApi, EndpointParamsApi, EndpointsApi, ProfileApi, RecActionApi, and ResultApi to inherit from BaseCrudApi, removing duplicated CRUD methods and constructors. This centralizes CRUD operations, reduces code duplication, and improves maintainability.
Renamed public API methods across ReC.Client.Api classes to use concise and uniform names (e.g., CreateAsync, UpdateAsync, DeleteAsync, GetAsync, InvokeAsync). Removed obsolete NETFRAMEWORK preprocessor blocks. Updated summary comment for Results property in ReCClient.cs. These changes improve naming consistency and code clarity throughout the client library.
Replaced all occurrences of "api/OutRes" with "api/Result" in ResultApi.cs for GET, POST, PUT, and DELETE operations. This ensures all result-related API requests now target the correct "Result" endpoint.
Added conditional using directives for System.Net.Http, System.Threading, and System.Threading.Tasks in multiple API files. These usings are now included only when targeting .NET Framework, improving compatibility and preventing unnecessary imports on other platforms.
Introduced internal static class ReCClientHelpers with methods to build query strings from key/value pairs and to create JsonContent payloads for HTTP requests. Includes conditional compilation for .NET Framework compatibility and XML documentation for both methods. Added necessary using directives.
Refactored ReCClient to expose grouped endpoint APIs as properties (e.g., RecActions, Results, Profiles, etc.), each handled by its own class. Removed direct endpoint methods from ReCClient and delegated them to these new API classes. Cleaned up using directives and improved code modularity for better maintainability and discoverability.
Introduced the ResultApi class in the ReC.Client.Api namespace to provide asynchronous methods for retrieving, creating, updating, and deleting output results via HTTP. The class uses an injected HttpClient, supports cancellation tokens, and leverages helper methods for query construction and JSON serialization.
Introduced RecActionApi in ReC.Client.Api to provide a typed API client for RecAction endpoints. Includes methods for invoking, retrieving, creating, updating, and deleting Rec actions, with support for cancellation tokens and helper-based serialization. All methods are documented with XML comments.
Introduced ProfileApi class in ReC.Client.Api to handle profile-related API endpoints. Supports retrieving, creating, updating, and deleting profiles using an injected HttpClient. Methods accept cancellation tokens and utilize helper methods for query building and JSON serialization. Includes XML documentation for all methods and parameters.
Introduced EndpointsApi class in ReC.Client.Api to handle create, update, and delete operations for endpoint definitions via HTTP requests. Methods are generic, support cancellation tokens, and use a helper for JSON serialization of payloads.
Introduced the EndpointParamsApi class in ReC.Client.Api to handle create, update, and delete operations for endpoint parameters via HTTP. Methods support generic payloads, cancellation tokens, and use JSON serialization helpers. Added necessary using directives for HTTP and threading.
Introduced the EndpointAuthApi class in ReC.Client.Api to handle endpoint authentication API interactions. This class provides async methods for creating, updating, and deleting endpoint authentication configurations using HttpClient, with support for cancellation tokens and JSON payload serialization. XML documentation is included for clarity.
Introduced the CommonApi class in the ReC.Client.Api namespace to provide generic methods for creating, updating, and deleting objects via HTTP. The class uses an injected HttpClient and supports asynchronous operations with optional cancellation tokens. All methods serialize payloads to JSON using ReCClientHelpers.ToJsonContent. XML documentation was added for clarity.
Renamed the controller class to ResultController for clarity and added the ReC.Application.Results.Queries using directive. Updated class documentation and parameter descriptions to better reflect the controller's purpose.
Refactored all "Result" related command and query classes from ReC.Application.OutResults to ReC.Application.Results. Updated all relevant using statements and reorganized files accordingly. No functional changes; this improves project structure and clarity.
Deleted the CreateResultViewCommand.cs file, including the obsolete CreateResultViewCommand and CreateResultViewCommandHandler classes. These were previously used for creating ResultView entities, but are now replaced by related procedures or views. All associated code and using directives have been removed.
Added "infrastructure", "presentation", and "core" solution folders. Moved projects into these new folders and updated the NestedProjects section to reflect the new organization. Adjusted parent GUIDs accordingly.
Added summary XML documentation to each member of the ResultType enum in the ReC.Client namespace, clarifying the purpose of Full, OnlyHeader, and OnlyBody options.
All synchronous (blocking) HTTP API methods have been removed from the ReCClient class, leaving only their asynchronous counterparts. These sync methods were previously marked as [Obsolete] and simply wrapped the async methods with .GetAwaiter().GetResult(). Additionally, the ToJsonContent method's return type was updated from HttpContent to JsonContent for improved type specificity.
Introduced TaskSyncExtensions class with Sync extension methods to allow synchronous execution of Task and Task<TResult> instances. This enables blocking on async code and is conditionally compiled for .NET Framework builds.
Use conditional compilation to set BuildQuery's tuple Value type
to object for .NET Framework and object? for other targets,
ensuring compatibility with nullable reference types across
different .NET versions.
Introduce async/sync methods for all major API controllers in ReCClient, supporting GET, POST, PUT, and DELETE with JSON serialization. Add utility methods for query building and JSON content. Mark sync wrappers as [Obsolete]. Add System.Net.Http.Json dependency and supporting usings. Introduce ResultType enum. This greatly expands ReCClient's API coverage and usability.
Renamed the GetProfile method to Get in the ProfileController to standardize method naming. No changes were made to the method's functionality or parameters.
Removed AutoMapper MappingProfile classes from ReC.Application.Endpoints and ReC.Application.RecActions. These profiles mapped command objects to DTOs with default values. The change reflects a move toward using procedures or views for these mappings.
Deleted DeleteOutResCommandValidator and ReadOutResQueryValidator classes, which were marked as obsolete. These validators are no longer needed due to a shift toward using related procedures or views for validation.
Removed deprecated command, query, and mapping classes for OutRes and RecAction entities, including their handlers and AutoMapper profiles. These components were previously marked as obsolete and have been superseded by database procedures or views. This cleanup eliminates redundant code and enforces the use of the updated data access patterns.
Deleted the ObtainEndpointCommand, its handler, and related using directives. This command was previously used to obtain or create Endpoint entities by URI, but has been removed in favor of using a related procedure or view as indicated by its Obsolete attribute.
Cleaned up DtoMappingProfile by removing mappings for several domain entities (OutRes, Connection, Endpoint, EndpointAuth, EndpointParam, Profile, RecAction) to their DTOs. Only view-to-DTO mappings remain. Also removed unused using directives.
Removed all DbSet properties and Fluent API configurations for obsolete domain entities (EndpointParam, OutRes, Connection, Endpoint, EndpointAuth, Profile, RecAction) from RecDbContext. These entities are now accessed via views, further enforcing the transition to view-based data access. Only view-based models remain configured in the context.
Removed DbSet properties for entities marked as obsolete in IRecDbContext, including EndpointParam, OutRes, Connection, Endpoint, EndpointAuth, Profile, and RecAction. Retained only DbSets for views and query results to encourage use of views instead of direct entity access. This streamlines the interface and aligns with the intended data access pattern.
Removed Root, Endpoint, EndpointAuth, and SqlConnection navigation properties from RecActionView, along with their [ForeignKey] and [Obsolete] attributes. This streamlines the data model by retaining only foreign key IDs and related string properties, reducing direct entity navigation in favor of using related procedures or views.
Removed Connection, Endpoint, EndpointAuth, EndpointParam, OutRes, Profile, and RecAction classes, which represented database tables and were marked as obsolete. This cleanup supports the transition to using database views or an updated data access approach. All related code, including attributes and properties, has been deleted.
Replaced unqualified EndpointAuth with Domain.Entities.EndpointAuth
in DtoMappingProfile and IRecDbContext to improve clarity and
avoid potential naming conflicts.
Introduced EndpointsController with POST, PUT, and DELETE API endpoints for managing endpoints. Utilizes MediatR to handle insert, update, and delete procedures, and retrieves configuration values as needed. Includes proper routing and response type annotations.
Introduced EndpointParamsController to manage endpoint parameter records using stored procedures. The controller supports POST (insert), PUT (update), and DELETE operations, leverages MediatR for command handling, and uses dependency injection for configuration and mediator services. Endpoints are documented and specify response types.
Introduced EndpointAuthController to manage endpoint authentication records via MediatR and procedure-based commands. Added POST (insert), PUT (update), and DELETE (range delete) endpoints. Controller uses dependency injection and provides XML documentation for each action.
Removed the entire ResultViewController.cs file, including all endpoints for result view queries and insertions. This eliminates support for fake profile IDs, result type filtering, and all related API logic from the codebase.
Refactored the Post method to return a 201 Created response using CreatedAtAction. This change adds a Location header pointing to the Get action with the relevant actionId, and includes both the new record's ID and actionId in the response body. This improves API usability and aligns with RESTful conventions.
Renamed CreateAction to Create and UpdateAction to Update in RecActionController to improve naming consistency. No changes to method logic or signatures.
Refactored RecActionController to support update via a new PUT endpoint using UpdateActionProcedure. Changed DELETE endpoints to use DeleteActionProcedure payloads instead of command objects, removing obsolete attributes. Updated using statements for new procedure types and standardized payload handling for update and delete operations.
Extended ProfileController with POST, PUT, and DELETE endpoints for profile management using InsertProfileProcedure, UpdateProfileProcedure, and DeleteProfileProcedure. Added necessary using directives and XML documentation for each new endpoint.
Renamed all `Guid` properties and parameters to `Id` in update procedure interfaces, records, and handlers. This clarifies that the identifier is a numeric ID, not a GUID, and improves consistency across the codebase. All related method signatures and usages have been updated accordingly.
Added POST endpoint to insert RESULT records and PUT endpoint to update RESULT records in OutResController. Integrated InsertResultProcedure and UpdateResultProcedure with MediatR, returning appropriate status codes. Updated using directives accordingly.
Moved Delete, Insert, and UpdateEndpointParamsProcedure classes from Common.Procedures to EndpointParams.Commands for better organization. Updated related imports in InsertObjectProcedure.cs and UpdateObjectProcedure.cs to reflect the new namespace. No functional changes to the procedures themselves.
Moved Delete/Insert/UpdateEndpointProcedure classes from Common.Procedures to Endpoints.Commands namespace. Updated using directives accordingly for improved code organization and maintainability. No changes to class logic.
Refactored Delete/Insert/UpdateEndpointAuthProcedure records into the new ReC.Application.EndpointAuth.Commands namespace for better organization. Updated using statements in related files to ensure compatibility. No functional changes to the procedure records themselves.
Moved Insert, Update, and Delete procedure records for Action, Profile, and Result entities from common namespaces to feature-specific namespaces. Updated all relevant using directives and controller references. No logic changes; this improves code organization and maintainability.
Refactored DELETE endpoints in OutResController to use the new DeleteResultProcedure payload instead of DeleteOutResCommand. Updated endpoints to call mediator.ExecuteDeleteProcedure and revised XML docs accordingly. Removed obsolete attributes and command references. The "fake" profile deletion now uses the procedure with the fake profile ID.
Enhanced `ExceptionHandlingMiddleware` to handle
`UpdateObjectFailedException` and `DeleteObjectFailedException`.
Logs exception details, including serialized procedure data,
and sets HTTP status to `500 Internal Server Error`.
Improves error differentiation and response for specific failure cases.
A new `DeleteObject` method has been added to the `CommonController` class to handle HTTP DELETE requests. This method is asynchronous and processes a `DeleteObjectProcedure` object passed in the request body using the `mediator.Send` function. The result is returned as an HTTP 200 OK response. The `[HttpDelete]` attribute has been applied to the method to designate it as a DELETE endpoint.
Enhanced `CommonController` to support object operations:
- Added `using` statements for Insert, Update, and Delete procedures.
- Updated constructor to inject `IMediator` for request handling.
- Introduced `UpdateObject` endpoint with HTTP PUT support.
- Processes `UpdateObjectProcedure` via MediatR.
- Returns HTTP 200 OK with the result.
Introduced a new `DeleteActionProcedure` record in the
`ReC.Application.Common.Procedures.DeleteProcedure` namespace.
This record implements the `IDeleteProcedure` interface and includes
the following properties:
- `Start`: Starting GUID/ID (inclusive).
- `End`: Ending GUID/ID (inclusive), defaults to `Start` if 0.
- `Force`: Allows deletion even if dependent RESULT data exists.
Added a `ToObjectProcedure` method to convert `DeleteActionProcedure`
to a `DeleteObjectProcedure` with the entity set to `"ACTION"`.
Introduce the `DeleteEndpointAuthProcedure` record in the new
`ReC.Application.Common.Procedures.DeleteProcedure` namespace.
This record implements the `IDeleteProcedure` interface and
provides properties for specifying a range of GUID/IDs (`Start`
and `End`) and a `Force` flag to allow deletion despite dependent
data.
Add the `ToObjectProcedure` method to convert the record into a
`DeleteObjectProcedure` with the entity set to `"ENDPOINT_AUTH"`.
A new `DeleteEndpointParamsProcedure` record was introduced in the
`ReC.Application.Common.Procedures.DeleteProcedure` namespace. This
record implements the `IDeleteProcedure` interface and provides
properties for specifying a range of GUID/IDs (`Start` and `End`)
and a `Force` flag to allow deletion even with dependent data.
The record includes a `ToObjectProcedure` method to convert its
data into a `DeleteObjectProcedure` instance, setting the entity
to `"ENDPOINT_PARAMS"` and mapping the `Start`, `End`, and `Force`
properties.
Introduced a new `DeleteEndpointProcedure` record in the
`ReC.Application.Common.Procedures.DeleteProcedure` namespace.
This record implements the `IDeleteProcedure` interface and includes
properties for specifying the start and end GUID/ID range, as well as
a `Force` flag to allow deletion even with dependent data.
Added a `ToObjectProcedure` method to convert the record into a
`DeleteObjectProcedure` with the entity set to "ENDPOINT".
Introduce the `DeleteProfileProcedure` record in the new
`ReC.Application.Common.Procedures.DeleteProcedure` namespace.
This record implements the `IDeleteProcedure` interface and
provides properties for specifying a range of GUID/IDs
(`Start`, `End`) and a `Force` flag to allow deletion even
with dependent ACTION data.
Added a `ToObjectProcedure` method to convert
`DeleteProfileProcedure` instances into `DeleteObjectProcedure`
objects, setting the `Entity` to `"PROFILE"`.
Introduced a new `DeleteResultProcedure` record in the
`ReC.Application.Common.Procedures.DeleteProcedure` namespace.
This record implements the `IDeleteProcedure` interface and provides
properties for specifying a range of GUID/IDs (`Start` and `End`)
and a `Force` flag.
Added a `ToObjectProcedure` method to convert the record into a
`DeleteObjectProcedure` with the entity set to "RESULT".
Introduced a new namespace `ReC.Application.Common.Procedures.DeleteProcedure` and added the `IDeleteProcedure` interface. This interface defines a `ToObjectProcedure` method, which returns a `DeleteObjectProcedure` object. These changes aim to standardize and encapsulate delete-related procedures in the application.
Introduce `DeleteObjectProcedure` to encapsulate parameters for
delete operations, including entity, ID range, and force flag.
Add `DeleteObjectProcedureExtensions` for convenient invocation
via `ISender`. Implement `DeleteObjectProcedureHandler` to
execute the `[dbo].[PRREC_DELETE_OBJECT]` stored procedure
using dynamic SQL parameters.
Throw `DeleteObjectFailedException` on failure and ensure
`End` defaults to `Start` if unset. Add XML documentation
for improved code clarity. Include necessary `using`
directives for dependencies.
A new `DeleteObjectFailedException` class was introduced in the
`ReC.Application.Common.Exceptions` namespace to handle errors
related to failed delete operations.
This class includes:
- A `Procedure` property of type `DeleteObjectProcedure` to
provide context about the failed operation.
- Three constructors to support different levels of detail
(procedure only, procedure with a message, and procedure with
a message and inner exception).
Additionally, a `using` directive for the
`ReC.Application.Common.Procedures.DeleteProcedure` namespace
was added to support the `DeleteObjectProcedure` type.
Introduced a new `UpdateResultProcedure` record in the
`ReC.Application.Common.Procedures.UpdateProcedure` namespace.
This record implements the `IUpdateProcedure` interface and
includes properties for `ActionId`, `StatusId`, `Header`, and
`Body`.
Added a `ToObjectProcedure` method to convert the record into
an `UpdateObjectProcedure` instance, setting the `Entity` to
"RESULT", and allowing optional tracking of changes via the
`ChangedBy` method.
Introduced a new namespace `ReC.Application.Common.Procedures.UpdateProcedure`.
Added the `UpdateProfileProcedure` record implementing the `IUpdateProcedure` interface.
This record includes several nullable properties such as `Active`, `TypeId`, `Name`, `Description`, and others.
Added the `ToObjectProcedure` method to convert the record into an `UpdateObjectProcedure` instance, setting the entity to "PROFILE" and supporting optional change tracking via `ChangedBy`.
A new `UpdateEndpointProcedure` record was introduced in the
`ReC.Application.Common.Procedures.UpdateProcedure` namespace.
This record implements the `IUpdateProcedure` interface and
includes nullable properties `Active`, `Description`, and `Uri`.
The `ToObjectProcedure` method was added to convert the record
into an `UpdateObjectProcedure` instance, setting the `Entity`
to `"ENDPOINT"`, the `Guid` to the provided parameter, and the
`Endpoint` to the current instance. The method also supports
tracking changes via the optional `changedWho` parameter.
A new `UpdateEndpointParamsProcedure` record has been added under the `ReC.Application.Common.Procedures.UpdateProcedure` namespace. This record implements the `IUpdateProcedure` interface and includes nullable properties such as `Active`, `Description`, `GroupId`, `Sequence`, `Key`, and `Value`.
Additionally, a `ToObjectProcedure` method has been introduced, which converts the record into an `UpdateObjectProcedure` instance with the `Entity` set to `"ENDPOINT_PARAMS"`, and supports optional tracking of the user who made the change.
Introduce the `UpdateEndpointAuthProcedure` record in the
`ReC.Application.Common.Procedures.UpdateProcedure` namespace.
This class implements the `IUpdateProcedure` interface and includes
properties for managing endpoint authentication details such as
`Active`, `Description`, `TypeId`, `ApiKey`, `ApiValue`, `Token`,
`Username`, `Password`, `Domain`, and `Workstation`.
Add the `ToObjectProcedure` method to convert the procedure into
an `UpdateObjectProcedure` instance, setting the entity to
`ENDPOINT_AUTH` and allowing optional tracking of the user who
made the changes.
Introduced a new `UpdateActionProcedure` record in the
`ReC.Application.Common.Procedures.UpdateProcedure` namespace.
This record implements the `IUpdateProcedure` interface and
includes several nullable properties such as `ProfileId`,
`Active`, `Sequence`, `EndpointId`, and others to support
update operations.
Added a `ToObjectProcedure` method to the record, which
creates and returns an `UpdateObjectProcedure` instance
with the entity set to "ACTION" and other relevant details.
This method also supports tracking changes via the `ChangedBy`
method.
Introduced a new namespace `ReC.Application.Common.Procedures.UpdateProcedure` and added the `IUpdateProcedure` interface. This interface defines a `ToObjectProcedure` method for converting to an `UpdateObjectProcedure`. The method accepts a `guid` parameter and an optional `changedWho` parameter to track changes. This addition establishes a contract for handling update procedures.
Introduce `UpdateObjectProcedure` to handle updates for various
entities using a stored procedure. Implement MediatR-based
request/response pattern with `IRequest<int>` and add the
`UpdateObjectProcedureHandler` to execute the update logic.
Include an extension method `ExecuteUpdateProcedure` for
simplified execution of update requests. Add exception handling
via `UpdateObjectFailedException` to manage update failures.
Integrate dependencies on `DigitalData.Core.Abstraction.Application.Repository`,
`MediatR`, and `Microsoft.Data.SqlClient`. Ensure extensibility
and reliability in the update process.
A new exception class, `UpdateObjectFailedException`, was added to the `ReC.Application.Common.Exceptions` namespace to handle failures during update operations.
The class includes a `Procedure` property of type `UpdateObjectProcedure` to store the associated procedure. It provides three constructors to support different levels of detail: one with just the procedure, one with a procedure and a custom message, and one with a procedure, a custom message, and an inner exception.
The `UpdateObjectProcedure` type is referenced from the `ReC.Application.Common.Procedures.UpdateProcedure` namespace, which is now included via a `using` directive.
Introduced entity configurations in `RecDbContext` for `Connection`, `Endpoint`, `EndpointAuth`, `EndpointParam`, `OutRes`, `Profile`, `ProfileView`, `RecAction`, and `RecActionView`. Mapped entities to corresponding tables or views with column configurations.
Added relationships:
- `Profile` to `Actions` (one-to-many).
- `RecAction` to `OutRes` (one-to-one with cascade delete).
Suppressed CS0618 warnings in `OnModelCreating` to handle obsolete members.
Several new DbSet properties were added to the RecDbContext
class, marked as `[Obsolete("Use Views instead.")]`. These
include `EndpointParams`, `OutRes`, `Connections`, `Endpoints`,
`EndpointAuths`, `Profiles`, and `RecActions`.
Non-obsolete DbSets such as `RecActionViews`, `ProfileViews`,
`RecResultViews`, `HeaderQueryResults`, `BodyQueryResults`,
and `RecResults` were also added or retained.
These changes indicate a shift towards using Views for database
operations while maintaining backward compatibility with the
older DbSet properties.
Updated the mapping configuration in `DtoMappingProfile` to use
the fully qualified name `Domain.Entities.Profile` for the
`Profile` entity. This change resolves potential ambiguity with
other classes named `Profile` in the codebase.
Updated ToObjectProcedure methods in Insert*Procedure records to use null as the default value for the addedWho parameter instead of "Rec.API". This affects InsertActionProcedure, InsertEndpointAuthProcedure, InsertEndpointParamsProcedure, InsertEndpointProcedure, and InsertProfileProcedure.
The AddedBy method in InsertObjectProcedure now accepts an optional parameter and sets AddedWho to "ReC.API" when no argument is supplied, ensuring a consistent default value.
Several entity-based DbSet properties in IRecDbContext are now marked with [Obsolete("Use Views instead.")], guiding developers to use view-based DbSets. The Profiles DbSet is now explicitly typed as Domain.Entities.Profile. No functional code was removed.
Refactored ReadProfileViewQuery and handler to return multiple profiles as IEnumerable<ProfileViewDto>. Made Id parameter optional to allow fetching all profiles. Updated exception handling for empty results.
Introduced ProfileController to the API, implementing a GET endpoint that uses MediatR to handle ReadProfileViewQuery requests and return profile data. This supports CQRS and structured profile retrieval.
Introduce CQRS/MediatR query and handler to fetch ProfileView by Id,
optionally including related Actions. Uses repository and AutoMapper,
throws NotFoundException if profile is missing, and returns ProfileViewDto.
Updated ResultViewController to use InsertResultProcedure instead of CreateResultViewCommand. Changed import statements, method parameters, and response construction to reflect the new procedure type.
Refactored the CreateAction endpoint to use InsertActionProcedure and mediator.ExecuteInsertProcedure, replacing the obsolete CreateRecActionCommand. Removed the deprecated CreateFakeAction endpoint and all related code from RecActionController.
Switched GET endpoints to ReadResultViewQuery for modernized query handling. Removed [Obsolete] from the controller class, but added it to DELETE endpoints to mark them as deprecated. Updated "fake" profile GET endpoints to use the new query model and removed obsolete warnings from these methods.
Replaced sender.Send and ToObjectProcedure with sender.ExecuteInsertProcedure, passing the InsertResultProcedure object, AddedWho config, and cancellation token directly. This simplifies and clarifies the result insertion process.
Changed IInsertProcedure.ToObjectProcedure to accept an optional addedWho parameter. Introduced InsertObjectProcedureExtensions with an ExecuteInsertProcedure extension for ISender, defaulting addedWho to "Rec.API" if not specified.
Replaced CreateOutResCommand with InsertResultProcedure when sending results. Updated property names (StatusId instead of Status) and now use ToObjectProcedure to include AddedWho. Added InsertProcedure namespace import.
CreateResultViewCommand is now marked obsolete, advising use of related procedures or views instead. Added an obsolete CreateResultViewCommandHandler that delegates creation to the repository.
Changed ToObjectProcedure to use a nullable addedWho parameter and set "Rec.API" as a fallback within the method, ensuring consistent default behavior.
Marked Connection, Endpoint, EndpointAuth, EndpointParam, OutRes, Profile, and RecAction classes as obsolete with [Obsolete("Use Views instead.")]. Added or updated [Table] attributes to specify database tables and schemas for each class. This signals a transition to using Views instead of these entities.
Update InsertObjectProcedureValidator to reference nested properties (e.g., x.Action.ProfileId instead of x.ActionProfileId) throughout all entity validation rules. Adjust .When conditions accordingly to match the new data model structure with grouped sub-objects.
Introduced CommonController in the ReC.API.Controllers namespace with a POST endpoint at "api/common". The endpoint accepts an InsertObjectProcedure from the request body, sends it via MediatR, and returns a 201 Created response with the generated ID.
Added DbSet properties for EndpointParam, RecActionView, and ProfileView to both IRecDbContext and RecDbContext. This enables querying and interaction with these entities and views in the database. Grouped the new DbSets under a #region for better code organization.
AddedWho is now set via the AddedBy method instead of direct assignment in object initializers. The property is made internal with a private setter to prevent external modification. All ToObjectProcedure methods in insert procedure records are updated to use AddedBy for consistency and encapsulation.
Updated ExceptionHandlingMiddleware to use the new Procedure property name when logging InsertObjectFailedException. Changed error title for BadRequestException to "Bad Procedure". Removed unused System.Text.Json using directive from InsertObjectProcedure.cs.
Add specific handling for InsertObjectFailedException in ExceptionHandlingMiddleware, including detailed logging and custom error response. Refactor InsertObjectFailedException to expose the request data via a public property for improved error reporting.
InsertObjectFailedException now requires an InsertObjectProcedure
instance, improving error context. Exception throwing in
InsertObjectProcedureHandler updated to pass the procedure object
instead of just a message and serialized request.
Updated IInsertProcedure and all implementations to accept an optional 'addedWho' parameter in ToObjectProcedure, defaulting to "Rec.API". This enables tracking of the entity responsible for insert operations.
Refactored insert procedure-related classes by moving each record type (Action, Endpoint, EndpointAuth, Profile, Result, EndpointParams) and the IInsertProcedure interface into their own files under the new InsertProcedure namespace. Updated InsertObjectProcedureValidator to use the new namespace. This improves code organization, readability, and maintainability.
Refactored insert procedure modeling by introducing the IInsertProcedure interface and entity-specific Insert[Entity]Procedure records. Each entity now has its own record with relevant properties and a ToObjectProcedure() method, improving type safety, clarity, and extensibility for insert operations. Updated InsertObjectProcedure to use these new types.
Reorganized InsertObjectProcedure by grouping related properties into nested record types (Action, Endpoint, EndpointAuth, Profile, Result, EndpointParams) for better encapsulation and maintainability. Updated handler logic to use new structure and set AddedWhen to DateTime.UtcNow. Improved error logging and added System.Text.Json usage.
Replace default return of 0 with InsertObjectFailedException when the stored procedure does not return a valid identifier. Exception message includes serialized request for easier debugging. Added necessary imports for exception and JSON serialization.
Refactored InsertObjectFailedException to use explicit constructors: parameterless, message-only, and message with inner exception. Removed constructors with optional parameters for clearer and more standard .NET exception handling.
Introduced InsertObjectFailedException in the ReC.Application.Common.Exceptions namespace. This exception provides constructors for custom messages and inner exceptions, and is intended to signal failures during object insertion operations.
Introduced InsertObjectProcedureValidator using FluentValidation to enforce required fields and string length constraints for InsertObjectProcedure. Validation rules are applied conditionally based on the Entity type, ensuring correct data for ACTION, ENDPOINT, PROFILE, RESULT, and ENDPOINT_PARAMS. Optional string fields also receive length checks.
Check if return value is already a long before parsing its
string representation. This enhances robustness and efficiency
when the value is of the correct type.
Introduces InsertObjectProcedure and its handler to support generic, parameterized insertion of various object types (ACTION, ENDPOINT, etc.) via a single stored procedure. The handler maps request properties to SQL parameters, executes the procedure, and returns the output GUID. This enables flexible and unified object creation through MediatR.
Renamed the InsertObject MediatR request record to InsertObjectProcedure and moved it from InsertObject.cs to InsertObjectProcedure.cs. The structure and functionality remain unchanged; it still defines an Entity property with a default value of "ACTION".
A TODO comment was added above OnModelCreating in RecDbContext to note that configuration should be updated to use appsettings.json in the future. No functional changes were made.
Removed [Column] attribute from InsertObjectResult and configured column mapping for NewObjectId in RecDbContext using the Fluent API. This centralizes entity mapping logic in the DbContext.
Added RecResults DbSet to IRecDbContext and RecDbContext to support managing InsertObjectResult entities. Updated IRecDbContext to include the new DbSet and ensured SaveChangesAsync is defined. Enables querying and persisting InsertObjectResult via EF Core.
Updated IRecDbContext to include DbSet properties for ProfileView and ResultView entities, enabling management of these collections within the context.
Introduced InsertObjectResult in ReC.Domain.QueryOutput with a required NewObjectId property mapped to the "oGUID" column. This class will be used to represent the result of object insert operations. Added necessary using directive for data annotations.
BodyQueryResult and HeaderQueryResult were relocated from ReC.Domain.Entities to ReC.Domain.QueryOutput. Updated all references in IRecDbContext and RecDbContext to use the new namespace.
Introduced InsertObject record in ReC.Application.Common.Procedures namespace. This record implements MediatR's IRequest<long> and includes a non-nullable Entity property to support object insertion operations.
Added navigation properties and foreign key relationships from Result to Action (one-to-many) and Profile (many-to-one) entities using ActionId and ProfileId. This enhances entity associations in the data model.
Added entity mapping to establish a one-to-many relationship between profiles and actions, with actions referencing their parent profile via the ProfileId foreign key.
ProfileView is now mapped to the VWREC_PROFILE table using the
[Table] attribute. Added an Actions property to support related
RecActionView collections.
Added entity configuration to define a one-to-many relationship between Actions and Results. Each Action can have multiple Results, and each Result references its parent Action via the ActionId foreign key.
Added Results, Root, Endpoint, EndpointAuth, and SqlConnection navigation properties to RecActionView, all marked as [Obsolete] to guide usage toward related procedures or views. Foreign key attributes applied where relevant.
Moved ReadResultViewQuery and its handler from ResultViews to OutResults namespace. Merged ResultView mapping profile into OutResults.MappingProfiles and removed the old MappingProfile class. Updated controller references accordingly for improved organization.
Relocated CreateResultViewCommand and its handler from ResultViews.Commands to OutResults.Commands. Updated all namespace references and using directives accordingly. Modified the project file to include the new folder structure. No functional changes to the command or handler logic.
Moved ReadRecActionViewQuery and MappingProfile from RecActionViews to RecActions namespace. Updated all references and using directives accordingly. This organizational change consolidates related queries and mapping profiles for improved clarity and maintainability.
Refactored InvokeBatchRecActionViewsCommand and InvokeRecActionViewCommand to ReC.Application.RecActions.Commands. Updated related handlers, records, and extension methods to use the new namespace. Removed obsolete using statement in RecActionController. No functional changes; organizational update only.
Mark ObtainEndpointCommand, its handler, and related mapping
profile as [Obsolete] with guidance to use the new procedure
or view-based approach. This deprecates the old command and
mapping logic in favor of updated patterns.
Added [Obsolete] attribute to "fake" Get methods in OutResController, as well as to ReadOutResQuery, ReadOutResHandler, and ReadOutResQueryValidator. These components are now deprecated in favor of related procedures or views. No functional changes were made.
Added the [Obsolete("Use the related procedure or view.")] attribute to DeleteOutResCommand, its handler, and its validator to indicate these should no longer be used and to guide consumers toward the recommended procedure or view.
Both CreateOutResCommandHandler and the MappingProfiles constructor are now marked with [Obsolete] attributes, warning developers to use the related procedure or view instead. This signals that these components are deprecated and may be removed in the future.
Updated [Obsolete] attribute messages across several commands,
handlers, and the mapping profile to clarify that related
procedures or views should be used instead. Added [Obsolete]
to CreateOutResCommand. No functional changes made.
Added [Obsolete("Use the related procedure.")] to RecAction creation and deletion commands, handlers, mapping profile, and related controller endpoints to indicate deprecation. No functional changes were made.
Upgraded the DigitalData.Core.Infrastructure NuGet package from version 2.6.0 to 2.6.1 in ReC.Infrastructure.csproj to include the latest fixes and improvements.
Upgraded DigitalData.Core.Abstraction.Application to v1.6.0 in ReC.Application.csproj and DigitalData.Core.Infrastructure to v2.6.0 in ReC.Infrastructure.csproj. No other changes made.
Removed the Root navigation property and its [ForeignKey("Id")] attribute from the ResultView class, as it is no longer needed. No other changes were made to the class structure.
Added CreateResultViewCommandHandler to process creation of ResultView entities using IRepository<ResultView>. Also updated using directives to include necessary repository and entity namespaces.
Introduce AuthScopedFilter to automatically set the AddedWho property on IAuthScoped commands using configuration, and register it globally for all controllers. Remove manual AddedWho assignment from ResultViewController. Make AddedWho nullable in AuthScope and IAuthScoped.
Changed AuthScope.AddedWho to be mutable (get; set;). In ResultViewController, set AddedWho from configuration in the Create action and throw an error if missing. Ensures AddedWho is always set and configuration issues are clearly reported.
Introduced AuthScopedValidator to enforce non-empty AddedWho on IAuthScoped entities with a clear error message. Registered all validators from the assembly in DI to enable automatic validation for authentication-scoped entities.
Added a new HTTP POST action to ResultViewController that accepts a CreateResultViewCommand in the request body. On success, it returns a 201 Created response with a reference to the Get action for the created resource. This enables clients to create new ResultView entries via the API.
Refactored ValidationBehavior to use C# 12 primary constructors and file-scoped namespaces, simplifying the Handle method logic. Updated CreateResultViewCommand to implement IAuthScoped and IRequest, replaced AddedWho with a non-serialized Scope property, and added necessary usings and namespace.
Introduce IScoped<TScope> interface for unified scope access and add AuthScope record. Remove legacy IScopedRequest interfaces to streamline scope management across the application.
Introduced IScopedRequestBase<TScope>, IScopedRequest<TScope>, and IScopedRequest<TScope, TResponse> interfaces to enable requests with scope information. These interfaces extend MediatR's IRequest types and enforce non-nullable scope types for improved request handling.
Introduced a MappingProfile in ReC.Application.ResultViews to map CreateResultViewCommand to ResultView, setting AddedWhen to DateTime.UtcNow during mapping. Included necessary using directives.
Introduced CreateResultViewCommand in the ReC.Application.ResultViews.Commands namespace. This class includes properties for ActionId, StatusCode, Header, Body, and AddedWho, and will be used as a command or DTO for creating ResultView entities.
Added [Table("VWREC_PROFILE", Schema = "dbo")] to ProfileView to specify its database table mapping. Included necessary using directive for DataAnnotations.Schema.
Move ResultType enum to ReC.API.Models/ResultType.cs and update its values from Header/Body to OnlyHeader/OnlyBody for improved clarity. Update all controller usages and documentation to reflect these changes.
Previously, OutResController and ResultViewController returned HTTP 200 OK with an empty object when the response body or header was null. Now, they return HTTP 404 Not Found in these cases, providing more accurate HTTP status codes for missing resources. Non-null bodies or headers continue to return HTTP 200 OK with the deserialized content.
Introduce ResultViewController with endpoints to fetch output results by query, for fake/test profiles, and by action ID. Supports returning full, header, or body parts of results via a new ViewResultType enum. Utilizes MediatR and configuration injection for flexible and testable result access. Includes XML docs for improved API clarity.
Added [Obsolete] attribute to OutResController, indicating it is deprecated and will be removed in future versions. Developers are advised to use ResultViewController instead.
Added ReadResultViewQueryHandler to support querying ResultView entities with optional filters (Id, ActionId, ProfileId). Integrated repository and AutoMapper, included error handling for no results, and improved using directives.
Introduced ReadResultViewQuery for querying result views with optional filters (Id, ActionId, ProfileId). Cleaned up ResultViewDto.cs by removing an unused using directive and reformatting the namespace declaration. Added necessary usings to support the new query.
Refactored ResultViewDto to use init-only properties for immutability. Added a new Root property of type OutResDto?. Included a using directive for ReC.Domain.Entities to support the new property.
Added OutRes? Root navigation property to ResultView, annotated with [ForeignKey("Id")], to establish an optional relationship to the OutRes entity. Also added the necessary using directive for DataAnnotations.Schema.
Replaced all usage of RecResultViewDto with ResultViewDto for improved naming consistency. Updated AutoMapper profile to map ResultView to ResultViewDto. Removed RecResultViewDto.cs and added ResultViewDto.cs with the same properties. No functional changes.
Replaced RecResultView with ResultView, updating all references in DbContext, entity mapping, and AutoMapper profiles. Added the new ResultView class and removed the old RecResultView class. No changes to properties or structure.
Added AutoMapper profile mappings for RecResultView to RecResultViewDto and ProfileView to ProfileViewDto to enable automatic entity-to-DTO conversions.
Introduced RecResultViewDto in the ReC.Application.Common.Dto namespace. This DTO encapsulates properties for result entity view data, including related action and profile details, status, content, and audit information.
Added Action and Profile navigation properties to RecResultView, enabling direct access to related RecActionView and ProfileView data for improved object relationships and easier data retrieval in views or APIs.
Changed ActionId, ProfileId, StatusCode, AddedWho, and AddedWhen
to nullable types in RecResultView to better support optional or
missing data scenarios. This improves compatibility with cases
where these fields may not always have values.
Renamed the StatusId property to StatusCode and Status to StatusName in RecResultView. Updated RecDbContext mappings accordingly to maintain consistency and improve code clarity.
Renamed the ResultHeader and ResultBody properties in the RecResultView class to Header and Body. Updated the RecDbContext entity configuration to map these new property names to the existing RESULT_HEADER and RESULT_BODY database columns. No changes were made to the database schema.
Added DbSet properties for RecResultView and OutRes to RecDbContext. Configured entity mapping for RecResultView to the VWREC_RESULT view, including key and property-to-column mappings. This enables querying RecResultView and OutRes through the context.
Introduced the RecResultView class in the ReC.Domain.Entities namespace. This class encapsulates properties related to recommendation results, including identifiers, status, result details, and audit metadata such as who added or changed the result and when.
Extracted "Logging" and "NLog" sections from appsettings.json into a new appsettings.Logging.json file. No changes were made to the logging settings themselves; this improves configuration separation and maintainability.
Dynamically adds all appsettings.*.json files in the root directory to the configuration, excluding appsettings.Development.json and appsettings.migration.json. This streamlines configuration management by automatically including relevant environment or custom config files.
Changed the entity configuration to map the ProfileType property to the "PROFILE_TYPE_ID" column instead of "PROFILE_TYPE" for consistency with database schema.
Replaced byte/byte? with the strongly-typed ProfileType/ProfileType? enum for profile type fields in ProfileView and RecActionView. Added the necessary using directive for ReC.Domain.Constants. This improves type safety and code readability.
Refactored ReadRecActionViewQuery to remove base class inheritance and make ProfileId optional. Simplified query construction and filtering logic in the handler to conditionally filter by ProfileId only when provided. Removed unused constructors and methods for a cleaner API.
Decouple InvokeBatchRecActionViewsCommand from ReadRecActionQueryBase, making it a plain IRequest with an explicit ProfileId property. Update the extension and handler to use the new structure, improving clarity and separation of concerns.
Changed ProfileType from string? to ProfileType? enum for improved type safety. Updated URI scheme assignment to use ToUriBuilderScheme(), centralizing scheme mapping logic.
Introduced the ProfileType enum with Http and Https values in the ReC.Domain.Constants namespace. Added ProfileTypeExtensions with a ToUriBuilderScheme method to convert enum values to their lowercase string representations for URI building.
Updated the ProfileType property in RecActionView from string? to byte? to improve type safety and performance by using a numeric value instead of a string.
RestType now inherits from byte for efficiency. The Invalid value has been removed from the enum, and the IsValid extension method was updated to reflect this change by only checking for None.
Changed ApiKeyLocation enum to use byte as its underlying type instead of the default int, reducing memory usage and improving clarity for serialization scenarios.
Explicitly define EndpointAuthType as a byte-based enum for improved memory efficiency and better interoperability with systems requiring a specific underlying type.
Changed several ProfileView properties (Type, Mandantor, ProfileName, LogLevel, Language, AddedWho) from non-nullable strings with default values to nullable strings. This allows these fields to be null instead of defaulting to an empty string.
Changed RecActionView.Profile to use ProfileView type instead of Profile entity. Added new ProfileViewDto class to represent profile data as a DTO, including related properties and audit fields.
Renamed the ProfileGuid property to Id in the ProfileView record.
Updated all DbContext mappings and primary key definitions to use
Id, while maintaining the mapping to the PROFILE_GUID column in
the database view.
Introduced the ProfileView entity as a record to represent data from the VWREC_PROFILE database view. Registered ProfileView in RecDbContext and configured its property mappings and primary key in OnModelCreating. This enables querying profile data via EF Core.
Switched from using RecActionDto to RecAction entity in the
DeleteRecActionsCommandHandler and updated repository types
and using statements accordingly. This aligns the handler
with domain-driven design and improves consistency.
Switched from using RecActionDto to RecAction domain entity in the CreateRecActionCommandHandler and updated relevant imports. This aligns the command handler with domain-driven design principles.
Updated ObtainEndpointCommandHandler to depend on IRepository<Endpoint> and IMapper. Now maps Endpoint entities to EndpointDto using AutoMapper before returning, ensuring proper separation of concerns and DTO exposure.
Refactored the null check for action.RestType to use pattern matching, assigning it to a local variable restType if not null. Now throws DataIntegrityException if RestType is null, and uses restType for creating the HttpRequestMessage. This improves code clarity and ensures RestType is non-null in subsequent logic.
Replaced string-based HTTP method mapping with a strongly-typed RestType enum for improved type safety. Updated the ToHttpMethod extension to accept RestType, validate its value, and convert it to the appropriate HttpMethod. This reduces errors from invalid or misspelled method names.
Renamed the extension method ToHttpMethod to ToHttpMethodName in the RestTypeExtensions class for improved clarity. The method's functionality remains unchanged; it still returns the uppercase string representation of the RestType enum value.
Renamed ProfileSequence to Sequence. Added display name properties for enums/types (e.g., EndpointAuthTypeName, RestTypeName, ErrorActionName). Added EndpointAuthApiKey. Changed RestType to enum and ErrorAction to nullable, with corresponding name properties.
Refactored RecActionView to use enum types for EndpointAuthType, ApiKeyLocation, and RestType, and added properties for their display names. Introduced ErrorAction and its display name. Updated RecDbContext mapping to treat RecActionView as a view with a key, map new enum ID and name fields, and align property mappings with the database view structure. This enhances clarity and supports both ID and human-readable values in the model.
Replaced references to ReC.Domain.Entities with ReC.Application.Common.Dto across multiple files to use DTOs in the application layer. Updated MappingProfile.cs namespace to ReC.Application.RecActionViews and adjusted using statements accordingly. These changes improve separation of concerns and ensure commands and mappings operate on DTOs rather than domain entities.
Introduced RestType enum in ReC.Domain.Constants to represent HTTP methods, including support for None and Invalid values. Added RestTypeExtensions with ToHttpMethod and IsValid methods to facilitate HTTP method handling and validation.
Changed DbSet properties in IRecDbContext from DTO types to their corresponding domain model classes for Connections, Endpoints, EndpointAuths, Profiles, and RecActions. This aligns the interface with the domain model and removes reliance on DTOs.
Added DTO classes for Connection, Endpoint, EndpointAuth, EndpointParam, Profile, and RecAction. Updated AutoMapper profiles, DbContext, and command handlers to use DTOs instead of domain entities. This decouples the application layer from the domain model, improving maintainability and flexibility. Cleaned up some using directives and file headers.
Standardize usage of RecActionViewDto across the codebase:
- Update pipeline behaviors, mapping profiles, and commands to use RecActionViewDto.
- Remove RecActionDto and introduce RecActionViewDto with equivalent properties and methods.
- Adjust query handlers and related interfaces to work with RecActionViewDto.
This clarifies DTO usage and aligns the model with domain intent.
Replaced all batch RecAction logic with RecActionViews equivalents. Updated controller methods to call InvokeBatchRecActionView instead of InvokeBatchRecAction. Removed InvokeBatchRecActionsCommand and its handler, and added InvokeBatchRecActionViewsCommand with similar logic for RecActionViews. This shifts batch processing from RecActions to RecActionViews across the codebase.
Refactored the RecAction invocation logic by renaming and moving InvokeRecActionCommand.cs to InvokeRecActionViewCommand.cs. Updated all class, record, and extension method names accordingly. The command handling logic remains unchanged, but all references and namespaces now reflect the new naming. Removed the old InvokeRecActionCommand.cs file.
Replaced ReadRecActionQuery and its handler with ReadRecActionViewQuery and ReadRecActionViewQueryHandler. Updated controller methods to use the new query type. This change clarifies and consolidates RecAction view query logic, improving code organization and domain alignment.
Moved CreateRecActionCommand and DeleteRecActionsCommand (and their handlers) from ReCActionViews.Commands to ReCActions.Commands. Updated all references in controller and mapping profile. Removed old files to improve code organization. No changes to command logic.
Renamed command and query files, namespaces, and usings from RecActions to RecActionViews for improved clarity and organization. Updated controller and mapping profile references accordingly. No changes to business logic or handler implementations.
Changed EndpointAuthType from string to enum in RecActionDto. Updated InvokeRecActionCommandHandler to use enum values in switch statements for improved type safety and maintainability.
Changed Type in EndpointAuth and EndpointAuthType in RecActionView from string? to EndpointAuthType? for improved type safety and clarity. This enforces the use of a specific enum for authentication types instead of plain strings.
Introduced the EndpointAuthType enum in the ReC.Domain.Constants namespace to represent various endpoint authentication methods, including NoAuth, ApiKey, BearerToken, JwtBearer, BasicAuth, DigestAuth, OAuth1, OAuth2, AwsSignature, and NtlmAuth. Each type is assigned a unique integer value for clear identification.
Added [Table] and [ForeignKey] attributes to entity classes to explicitly map them to database tables/views and define relationships. Updated using directives as needed. Improves entity mapping clarity and robustness against schema changes.
Changed DbSet properties to get/set in IRecDbContext, renamed Actions to RecActionViews for consistency, and added DbSets for Connections, Endpoints, EndpointAuths, Profiles, and RecActions. Updated RecDbContext implementation accordingly.
Refactored the "API Key" authentication logic to use a switch
statement on the API key location, improving code clarity.
Added a default case to throw a DataIntegrityException for
unsupported API key locations, enhancing error handling.
Changed EndpointAuthApiKeyAddTo from string? to ApiKeyLocation? enum in RecActionDto for type safety. Updated related logic in InvokeRecActionCommandHandler to use the enum, and added the necessary using directive for ReC.Domain.Constants.
Updated EndpointAuth and RecActionView to use the ApiKeyLocation enum for API key location properties instead of nullable strings. Added necessary using directives for ReC.Domain.Constants to support this change, improving type safety and code clarity.
Changed RecActionDto.ErrorAction from string to ErrorAction enum, updating all related logic to use enum values instead of strings. Added necessary using directives. This improves type safety, reduces risk of typos, and enhances maintainability.
Changed ErrorAction property in RecAction from string? to ErrorAction? enum for improved type safety. Added import for ReC.Domain.Constants to support the new type.
Changed ErrorAction enum namespace from ReC.Application.Common.Constants to ReC.Domain.Constants to better reflect its domain relevance. Removed the file's BOM. Enum members remain unchanged.
Introduced the ErrorAction enum in the ReC.Application.Common.Constants namespace with Stop and Continue values to standardize error response actions across the application.
Replaced the old HttpClientName constant in Constants.cs with a new Http.ClientName in the ReC.Application.Common.Constants namespace. Updated all references and using directives accordingly to improve code organization and maintainability.
The Message property was deleted from the OutRes class, and its corresponding Entity Framework mapping was removed from RecDbContext. This cleans up unused fields from both the model and database context configuration.
Introduced a Constants class to define a unique HttpClientName for HTTP client registration and usage. Updated DependencyInjection and InvokeRecActionCommandHandler to use this centralized name, improving consistency and reducing risk of name collisions.
Throw NotImplementedException for unsupported authentication types
in InvokeRecActionCommandHandler, including details like ProfileId
and Id in the exception message for easier debugging. This prevents
silent failures when encountering unknown authentication methods.
Centralize HttpClient configuration using IHttpClientFactory with a named "Default" client. Move NTLM authentication logic from HttpClientHandler to request-level options, improving testability and aligning with .NET best practices.
Expanded InvokeRecActionCommandHandler to support API Key, Bearer/JWT/OAuth2, Basic, and NTLM authentication schemes. Added necessary imports and logic for header/query manipulation and credential handling. Left placeholders for Digest, OAuth 1.0, and AWS Signature. Improves flexibility and robustness of outgoing HTTP requests.
Introduced a switch statement to handle various endpoint authentication types in InvokeRecActionCommandHandler. Cases for common auth methods have been added as placeholders, preparing the codebase for future implementation of specific authentication logic.
Added .Include(act => act.EndpointAuth) to eagerly load the EndpointAuth navigation property when retrieving RecActionView entities. Also made a minor formatting adjustment to the check for empty action results.
Added EndpointAuth navigation property to RecActionView with [ForeignKey("EndpointAuthId")], enabling direct access to related authentication data via Entity Framework.
Updated <Version>, <AssemblyVersion>, <FileVersion>, and <InformationalVersion> fields in the project file from 1.0.2-beta to 1.0.3-beta. No other changes were made.
Introduce ErrorAction property to RecActionDto for per-action error handling. Update InvokeRecActionsCommandHandler to check invocation results and use ErrorAction to determine whether to continue or stop on failure, enabling configurable batch processing behavior.
Add ErrorAction to RecActionDto and batch error handling
Introduce ErrorAction property to RecActionDto for per-action error handling. Update InvokeRecActionsCommandHandler to check invocation results and use ErrorAction to determine whether to continue or stop processing on failure. This enables configurable error handling in batch action execution.
Added the ErrorAction property to the RecAction class for specifying error handling actions. Updated RecDbContext to map this property to the ERROR_ACTION database column.
Changed InvokeRecActionCommand and its handler to return a boolean indicating success or failure, allowing consumers to check if the action was successful. This improves clarity and error handling in command execution.
CreateOutResCommand now includes optional Status and Message properties to capture additional result details. The HTTP response status code is recorded in Status when creating an output result in InvokeRecActionCommandHandler.
Added Status and Message properties to the entity configuration in RecDbContext.cs, mapping them to the STATUS and MESSAGE database columns. This allows the entity to store and retrieve these additional fields.
Added three new nullable properties—Status (short), Message (string), and Header (string)—to the OutRes class to support additional metadata and state information.
Changed Invoke action to use profileId as a route parameter. Updated Get method XML docs to reflect use of ReadRecActionQuery from query string instead of profileId.
Changed the RecActionController Invoke route to remove the {cmd}
parameter, now accepting POST requests at "invoke" only.
Refactored DbModelOptions.EnsureEntity<T> by removing the
entities dictionary conversion logic for virtual and non-virtual
entities.
Renamed local variable from 'cluster' to 'entities' in EnsureEntity<T> and unified logic for selecting entity options. Improved readability by consistently using entities.TryGetValue and clearer variable naming.
Refactored DbModelOptions and EntityBaseOptions to throw DbModelConfigurationException instead of InvalidOperationException for configuration errors. Added necessary using directives for the new exception type to improve error clarity and specificity.
Introduced DbModelConfigurationException in the ReC.Infrastructure.Exceptions namespace. This custom exception inherits from Exception and includes both a message constructor and a parameterless constructor for flexible error handling related to DB model configuration issues.
Introduce EnsureEntity<T>(bool isVirtual) to validate and ensure entity options exist for a given type in either Entities or VirtualEntities. Throws an exception if options are missing.
Changed Entities and VirtualEntities from IEnumerable to Dictionary<string, T> in DbModelOptions, enabling direct access by string keys and improving lookup efficiency.
Added a new ColumnNames property that exposes the column names from the ColumnMappings dictionary as an IEnumerable<string> in the EntityBaseOptions record. This provides convenient access to mapped column names alongside existing property name access.
Introduce PropertyNames as a read-only property exposing the keys of ColumnMappings. Refactor EnsureProperties to use PropertyNames for improved clarity and maintainability.
Renamed the ColumnName property to ColumnMappings in the EntityBaseOptions record for improved clarity and consistency. Updated all internal references accordingly; no changes to logic or initialization.
Added EnsureProperties<T>() to EntityBaseOptions, enabling automatic validation of required properties marked with MustConfiguredAttribute via reflection. This reduces manual configuration and improves maintainability.
Added MustConfiguredAttribute for property usage in ReC.Domain.Attributes. Removed explicit "Attributes\" folder reference from ReC.Domain.csproj since the folder now contains code.
Renamed the Columns property to ColumnName in EntityBaseOptions.cs,
updating all references accordingly. Added an "Attributes" folder
entry to ReC.Domain.csproj for future organization.
Added a public EnsureProperties method accepting a params string[] in EntityBaseOptions. This provides a more convenient way to ensure multiple properties are configured, internally delegating to the existing IEnumerable-based method.
Introduce EnsureProperties to validate required property names
against the Columns dictionary, throwing an exception if any
are missing. This helps enforce configuration completeness.
Introduced DbModelOptions in ReC.Infrastructure.Options to encapsulate collections of EntityOptions and VirtualEntityOptions, providing a structured way to configure entities and virtual entities. Both properties are initialized to empty collections by default.
Introduce EntityBaseOptions with Columns property.
Update EntityOptions and VirtualEntityOptions to inherit from EntityBaseOptions for improved code reuse and consistency.
Renamed Table to TableOptions and moved it, along with EntityOptions and VirtualEntityOptions, to the ReC.Infrastructure.Options.Shared namespace. Split records into separate files for better modularity and updated EntityOptions to reference TableOptions. This enhances code organization and naming consistency.
Introduced two new record types: VirtualEntityOptions (currently empty) and EntityOptions, which encapsulates a Table instance. These additions lay groundwork for future entity configuration options.
Introduced a new Table record with Name and optional Schema properties under the ReC.Infrastructure.Options namespace. This addition provides a structured way to represent database table metadata.
Deleted the RecActionView class, including all properties and data annotations, removing its mapping to the VWREC_ACTION view and related relationships from the codebase.
Moved all RecAction table and column mappings from data annotations in the entity class to Fluent API configuration in RecDbContext. Also consolidated the OutRes relationship setup into the new configuration block, removing redundant mapping code. RecAction is now a plain class without EF attributes.
Moved table and column mapping for Profile from data annotations
in the entity class to Fluent API configuration in RecDbContext.
Removes dependency on DataAnnotations in Profile.cs and
centralizes entity configuration in the DbContext.
Moved EF Core configuration for EndpointAuth from data annotations in the entity class to Fluent API in RecDbContext. This centralizes table, key, and property mappings, improving maintainability and consistency.
Removed data annotations from Endpoint class and defined its table, key, and column mappings using Fluent API in RecDbContext. This centralizes entity configuration and improves code maintainability.
Removed data annotations from Connection.cs and moved all table and column mapping to RecDbContext's OnModelCreating using the Fluent API. This centralizes entity configuration and removes dependencies on DataAnnotations in the entity class.
Removed data annotation from HeaderQueryResult and mapped RawHeader to REQUEST_HEADER using Fluent API in RecDbContext. Centralizes entity configuration in the DbContext.
Refactored the OutRes class to eliminate all Entity Framework Core data annotations, including table, key, column, and foreign key attributes. The entity now contains only property definitions, decoupling it from direct database schema mapping and allowing for alternative configuration or usage outside of EF Core.
Refactored EndpointParam by removing all Entity Framework Core
data annotations and related using directives. The class now
contains only plain C# properties, with database mapping
responsibilities likely moved to Fluent API or another ORM
configuration approach.
Added explicit table and column mappings for RecActionView in DbContext. The entity is now mapped to the "VWREC_ACTION" table in the "dbo" schema, with each property aligned to its corresponding database column for improved accuracy.
Replaced data annotation with Fluent API configuration for BodyQueryResult.RawBody column mapping in RecDbContext, centralizing entity configuration and removing the [Column("REQUEST_BODY")] attribute from the entity class.
Added DeleteBehavior.Cascade to the RecAction-OutRes one-to-one relationship in RecDbContext. Now, deleting a RecAction will also delete its related OutRes entity automatically. Previously, the delete behavior was not specified.
Added several using directives to Program.cs for new dependencies. Updated HTTP pipeline to redirect requests from "/" to "/swagger" when Swagger is enabled, improving developer experience by automatically showing the API documentation.
Refactored InvokeRecActionsCommandHandler to only require ISender,
removing IServiceScopeFactory, IHttpClientFactory, and ILogger.
Replaced concurrent invocation and error handling with a simple
sequential loop, streamlining batch recommendation action execution.
Updated `<Version>`, `<AssemblyVersion>`, and `<FileVersion>`
to reflect the minor version update from 1.0.0-beta to
1.0.1-beta. `<InformationalVersion>` remains unchanged.
The `[ProducesResponseType(StatusCodes.Status400BadRequest)]`
attribute was removed from the `Delete` method in the
`OutResController` class. This change simplifies the API
response documentation, leaving only the `204 No Content`
response explicitly defined. The method is no longer expected
to return a `400 Bad Request` status code, reflecting a change
in behavior or a decision to streamline the API's response
documentation.
Added a new `Delete` method to the `OutResController` class to
delete all output results for a fake/test profile. The method
is accessible via the `DELETE /fake` route and supports
cancellation via a `CancellationToken`.
Included XML documentation for the method, describing its
purpose, parameters, and return type. Added `[ProducesResponseType]`
attributes to specify possible HTTP response codes: `204 No Content`
for success and `400 Bad Request` for invalid requests.
The method uses `IMediator` to send a `DeleteOutResCommand`
with a `ProfileId` obtained from the `IConfiguration` instance.
Added a new HTTP DELETE endpoint to the OutResController to allow deletion of output results based on criteria provided in the DeleteOutResCommand. The endpoint supports cancellation via a CancellationToken and returns a 204 No Content response on success. Updated using directives to include necessary namespaces for commands and queries. Added response type annotations for better API documentation.
Enhanced the `DeleteOutResCommand` and `DeleteOutResCommandHandler`
with detailed XML documentation comments. These comments describe
the purpose, usage, and deletion logic, including criteria based
on `ActionId` or `ProfileId`. Improved clarity for maintainers
and users of the codebase.
Updated using directives to include necessary dependencies for
repository and domain entities. Introduced the
DeleteOutResCommandHandler class to handle DeleteOutResCommand
requests. The handler uses IRepository<OutRes> to delete records
based on ActionId or ProfileId. Implemented asynchronous
deletion logic with support for cancellation tokens.
Introduce DeleteOutResCommandValidator using FluentValidation
to enforce business rules for the DeleteOutResCommand. Added
a validation rule to ensure at least one of ActionId or
ProfileId is provided, with a descriptive error message if
neither is present. Included necessary using directives for
FluentValidation and the relevant namespace.
Introduced the `DeleteOutResCommand` record in the `ReC.Application.OutResults.Commands` namespace. This command implements the `IRequest` interface from `MediatR` and includes two nullable properties: `ActionId` and `ProfileId`. Added the `MediatR` library to support the CQRS pattern.
Replaced the `ProfileSequence` property with `Sequence` in the
`RecActionView` class. Updated the database column mapping
from `PROFILE_SEQUENCE` to `SEQUENCE`. This change aligns
with updates to the database schema and improves naming
consistency.
Added a condition in `Program.cs` to enable Swagger when the `UseSwagger` configuration value is `true`, in addition to the development environment.
Introduced a new `UseSwagger` setting in `appsettings.json` with a default value of `true`, allowing Swagger to be conditionally enabled in non-development environments. This improves flexibility for Swagger usage across different environments.
A `<Description>` tag was added to the `ReC.Client.csproj` file.
This tag describes the project as a client library for interacting
with the ReC.API, offering typed HTTP access and DI integration.
This change improves project metadata for better documentation
and package management.
Added a new "Solution Items" project to the solution file, including an `assets/icon.png` file. Updated `ReC.Client.csproj` with packaging metadata such as `PackageId`, `Authors`, `Company`, and `Version`. Included `icon.png` in the package and updated `<TargetFrameworks>` to support `net8.0`. Added the `icon.png` file to the project.
A new static method `BuildStaticClient(Action<HttpClient> configureClient)`
was added to the `ReC.Client` namespace in `ReCClient.cs`. This method
configures and builds a static `IServiceProvider` for creating `ReCClient`
instances. It includes XML documentation detailing its purpose, usage,
and parameters, and warns that it should only be called once during
application startup.
The method accepts an `Action<HttpClient>` parameter for `HttpClient`
configuration and throws an `InvalidOperationException` if the static
provider is already built. It is marked `[Obsolete]` to encourage the
use of a local service collection instead of the static provider.
Additionally, the XML documentation for the `ReCClient` creation method
was updated to reference the new `BuildStaticClient` method.
Simplified the HTTP client configuration in the `BuildStaticClient` method of the `ReC.Client` namespace. Replaced the explicit use of `Services.AddHttpClient` with a call to `Services.AddRecClient(apiUri)`. This change improves code readability and reusability by encapsulating the HTTP client setup logic in a dedicated method or extension.
Refactored the `Create` method in the `ReCClient` class to directly resolve a `ReCClient` instance from the dependency injection container using `Provider.GetRequiredService<ReCClient>()`.
Removed the intermediate step of retrieving an `IHttpClientFactory` and manually creating a `ReCClient` object. This change reduces boilerplate code and assumes `ReCClient` is already registered in the container, improving maintainability.
Added `services.AddScoped<ReCClient>()` to both `AddRecClient`
method overloads in `DependencyInjection.cs` to ensure proper
scoped registration of `ReCClient`.
Updated `ReC.Client.csproj` to include necessary package
references for dependency injection and HTTP client support:
- `Microsoft.Extensions.DependencyInjection` (v10.0.0)
- `Microsoft.Extensions.Http` (v8.0.0)
- `System.Net.Http` (v4.3.4)
The `BuildStaticClient` and `Create` methods in the `ReC.Client` namespace have been marked with the `[Obsolete]` attribute. These methods now include a message advising developers to use a local service collection instead of the static provider. This change serves as a warning that these methods are outdated and may be removed in future versions, encouraging a transition to a more modern design.
- Added comprehensive XML documentation for `DependencyInjection`
and `ReCClient` classes to improve code readability.
- Introduced overload for `AddRecClient` to allow flexible
`HttpClient` configuration.
- Added static `BuildStaticClient` and `Create` methods for
simplified client instantiation.
- Marked synchronous `InvokeRecAction` method as obsolete to
encourage asynchronous usage.
- Updated `ReC.Client.csproj`:
- Added `<DocumentationFile>` property for XML doc generation.
- Downgraded `Microsoft.Extensions.Http` to version 8.0.0.
- Removed `System.Text.Json` package reference.
- Removed `System.Text.Json` dependency from `ReCClient.cs`.
- Generated unique `HttpClient` name for `ReCClient` instances.
- Performed general code cleanup and improved method remarks.
Replaced the `ReCClient.Static` property with a `ReCClient.Create()` method to improve clarity and align with best practices. The new method retains the same functionality, including throwing an `InvalidOperationException` if the `Provider` is not built. The logic for retrieving the `IHttpClientFactory` and creating a `ReCClient` instance remains unchanged.
Renamed the static field `ServiceProvider` to `Provider` across
the `ReC.Client` namespace in `ReCClient.cs` for consistency
and clarity. Updated all occurrences, including declarations,
usages, and exception messages. Adjusted conditional compilation
blocks to reflect the new name. Ensured the `BuildStaticClient`
method and `Static` property use the renamed field appropriately.
Updated the `ServiceProvider` field in the `ReC.Client` namespace to use conditional compilation for framework-specific behavior:
- Added `NET8_0_OR_GREATER` directive to define `ServiceProvider` as nullable (`IServiceProvider?`) for .NET 8.0 or greater.
- Retained non-nullable `IServiceProvider` for other frameworks.
- Removed redundant `#if nullable` directives to simplify the code.
- Streamlined initialization logic for better clarity and maintainability.
Introduced dependency injection to the `ReCClient` class by adding `Microsoft.Extensions.DependencyInjection`. Added a static mechanism for creating and managing a `ReCClient` instance, including a `BuildStaticClient` method to configure the HTTP client and a `Static` property to retrieve the client. Implemented error handling to ensure proper initialization of the static service provider.
Added the `[Obsolete]` attribute to the `InvokeRecAction` method
in the `ReC.Client` namespace to discourage its use. The attribute
recommends using the `InvokeRecActionAsync` method instead to
avoid potential deadlocks and improve performance.
Added a synchronous version of the `InvokeRecAction` method to
the `ReC.Client` namespace in `ReCClient.cs`. This method
invokes the `POST api/RecAction/invoke/{profileId}` endpoint
synchronously using `GetAwaiter().GetResult()` and returns a
boolean indicating success.
Also included XML documentation comments for the new method,
detailing its purpose, parameters, and return value.
The method `InvokeRecActionAsync` in the `ReC.Client` namespace was updated to return a `bool` instead of `Task`. This change allows the method to indicate whether the HTTP request was successful.
- Updated the return type from `Task` to `Task<bool>`.
- Modified the `<returns>` XML documentation to reflect the new behavior.
- Replaced `resp.EnsureSuccessStatusCode()` with `resp.IsSuccessStatusCode` to return the success status directly.
Updated the parameter name in the `InvokeRecActionAsync` method
to `cancellationToken` for better readability and alignment
with standard naming conventions. Adjusted the method signature
and internal usage to reflect this change.
Removed the `InvokeRecActionFakeAsync` method, which was used to invoke a fake RecAction via the `api/RecAction/invoke/fake` endpoint. This method is no longer needed or relevant.
The `InvokeRecActionAsync` method remains in place to handle RecActions for specific profile IDs via the `api/RecAction/invoke/{profileId}` endpoint.
Added a `using System.Net.Http;` directive within a `#if NETFRAMEWORK` block in `DependencyInjection.cs` to ensure compatibility with .NET Framework.
Introduced the `AddRecClient` extension method in the `DependencyInjection` class to enable custom configuration of `HttpClient` instances via an `Action<HttpClient>` delegate.
Introduced a `DependencyInjection` class in the `ReC.Client`
namespace to enable dependency injection for `ReCClient`.
Added an `AddRecClient` extension method for `IServiceCollection`
to register an `HttpClient` with a configurable `apiUri` as the
base address.
Included conditional `using System;` for .NET Framework
compatibility and added `Microsoft.Extensions.DependencyInjection`
to support DI services.
- Removed unused `System.Xml.Linq` namespace import.
- Simplified code by removing `#if NETFRAMEWORK` directives.
- Added `ClientName` field to uniquely identify HTTP clients.
- Updated constructor to use named HTTP client with `ClientName`.
- Removed unused `_jsonOptions` field for better code clarity.
Updated ReCClient to use IHttpClientFactory for improved
resource management and testability. Added package
references for `Microsoft.Extensions.Http`, `System.Net.Http`,
and `System.Text.Json` to support HTTP client functionality
and JSON serialization. Included `System.Xml.Linq` for
potential XML-related operations. Updated constructor logic
to create `HttpClient` instances via the factory pattern.
A new asynchronous method `InvokeRecActionFakeAsync` was added to the `ReC.Client` namespace in `ReCClient.cs`. This method sends a POST request to the `api/RecAction/invoke/fake` endpoint. It includes XML documentation comments and accepts an optional `CancellationToken` parameter. The method ensures the response has a successful status code.
Added the `InvokeRecActionAsync` method to the `ReCClient` class in the `ReC.Client` namespace. This method performs an asynchronous HTTP POST request to the `api/RecAction/invoke/{profileId}` endpoint. It accepts a `profileId` parameter to specify the profile ID and an optional `CancellationToken` for task cancellation. The method ensures the HTTP response indicates success by calling `EnsureSuccessStatusCode()`. Included XML documentation comments for clarity and maintainability.
Added `ReCClient` class to handle HTTP requests with JSON
serialization/deserialization support. Updated `ReC.Client.csproj`
to include `System.Net.Http` (v4.3.4) and `System.Text.Json`
(v9.0.11) as package references. Introduced conditional `using`
directives for `NETFRAMEWORK` compatibility.
The `logFileNamePrefix` variable in the `NLog` configuration was updated to use a period (`.`) instead of a hyphen (`-`) as the separator between the date and the application name.
Old format: `${shortdate}-Rec.API.Web`
New format: `${shortdate}.Rec.API`
This change aligns the log file naming convention with a new standard or improves consistency across file naming practices.
- Integrated `NLog` for improved logging capabilities.
- Added a logger instance and initialized logging with `NLog`.
- Wrapped app setup in a `try-catch` block to handle startup exceptions.
- Configured logging to use `NLog` in non-development environments.
- Refactored service registration for better organization.
- Retained key configurations for `AddRecServices` and `AddRecInfrastructure`.
- Reorganized middleware pipeline setup for clarity.
- Added exception logging during startup to improve debugging.
Updated the copyright year to 2025 for "Digital Data GmbH."
Added `NLog` (v5.2.5) and `NLog.Web.AspNetCore` (v5.3.0)
package references to introduce logging capabilities.
No functional changes were made to the `Swashbuckle.AspNetCore`
package reference, though it was reformatted slightly.
Added a new NLog configuration section in `appsettings.json` to enable structured logging. This includes settings for log file storage, log targets for different levels (Info, Warn, Error, Fatal), and retention policies.
Added the `NLog` property to the configuration. Introduced a new `AddedWho` property with the value `ReC.API`.
Removed and re-added the `FakeProfileId` property without changing its value. No changes were made to `LuckyPennySoftwareLicenseKey` or `RecAction` sections.
The `<DesktopBuildPackageLocation>` property in `IISProfile.pubxml`
was updated to remove the hardcoded `net8` subdirectory. The path
now dynamically uses the `$(Version)` variable directly under the
`API` directory, improving flexibility and reducing the need for
manual updates when versions change.
Added an XML declaration and structured the IIS publish profile
with a `<Project>` root element and a `<PropertyGroup>`
containing key properties for web publishing. Configured the
publish method as `Package`, set the build configuration to
`Release`, and specified the IIS deployment path. Included
settings for packaging as a single file and defined the build
package location with a version placeholder.
Enhanced the project file (`ReC.API.csproj`) with metadata
to prepare the package for distribution. Added properties
such as `PackageId`, `Authors`, `Company`, `Product`,
`PackageIcon`, `PackageTags`, `Version`, `AssemblyVersion`,
`FileVersion`, `InformationalVersion`, and `Copyright`.
These changes ensure the package contains detailed
information for consumers and aligns with NuGet standards.
Updated the `Invoke` method in `RecActionController` to use `cmd` as the route parameter instead of `profileId`, modifying the HTTP POST route to `invoke/{cmd}`.
Refactored the `Delete` method to accept a `DeleteRecActionsCommand` object (`cmd`) instead of `profileId`. Removed the hardcoded `ProfileId` assignment and passed the `cmd` object directly to `mediator.Send`.
Made the `ProfileId` property in `DeleteRecActionsCommand` required by removing its default value, enforcing explicit initialization. This improves validation and ensures flexibility for future enhancements.
These changes enhance the API's clarity, flexibility, and maintainability.
Simplified the `Get` method in `RecActionController` by replacing
the `profileId` parameter with a `ReadRecActionQuery` object.
This eliminates the need to manually construct the query object
within the method, improving code readability and reducing
redundancy.
The `Get` method in the `RecActionController` class was updated to use the `[FromQuery]` attribute for the `invoked` parameter. This change ensures that the parameter value is explicitly bound from the query string of the HTTP request, improving clarity and alignment with expected usage.
Updated the Get method in RecActionController to include a
new optional parameter, `invoked`, with a default value of
`false`. Updated XML documentation to reflect this change.
Modified the `ReadRecActionQuery` initialization to pass the
`invoked` parameter. Removed the previous method signature
that only accepted a `CancellationToken`.
Updated `InvokeBatchRecActionsCommandExtensions` to filter actions with `Invoked = false` using a lambda in `ToReadQuery`.
Refactored `ReadRecActionQueryBase` to remove the `Invoked` property and updated `ToReadQuery` to accept a delegate for external query modifications.
Moved the `Invoked` property to `ReadRecActionQuery` and added a parameterless constructor.
These changes improve flexibility and enable dynamic query customization.
Introduced a nullable `Invoked` property in `ReadRecActionQueryBase`
to enable conditional filtering of actions based on `Root.OutRes`.
Added a `ToReadQuery` method for easier query conversion.
Refactored `ReadRecActionQueryHandler` to apply dynamic filtering
based on the `Invoked` property:
- `true`: Filters actions with non-null `Root.OutRes`.
- `false`: Filters actions with null `Root.OutRes`.
- `null`: No additional filtering applied.
Replaced hardcoded filtering logic with the new dynamic approach.
Renamed the `RootAction` property to `Root` in the `RecActionView` class to improve clarity and align with naming conventions. Updated the `ReadRecActionQueryHandler` class to reference the renamed property in its LINQ query, ensuring consistency between the data model and query logic.
Enhanced the `Handle` method in `ReadRecActionQueryHandler`
to include an additional filtering condition when querying
the repository. The query now filters actions where
`RootAction.OutRes` is not null, in addition to matching
the `ProfileId`. This ensures that only relevant actions
with a valid `OutRes` are included in the result set.
Introduced a new `OutRes` navigation property in the `RecAction`
class to establish a one-to-one relationship with the `OutRes`
entity. Updated `RecDbContext` to configure this relationship
using the Fluent API. The `OutRes` entity references its
associated `RecAction` via the `Action` navigation property,
with `ActionId` as the foreign key.
Introduced a new nullable `RootAction` property in the `RecActionView` class. This property is decorated with the `[ForeignKey("Id")]` attribute, establishing a foreign key relationship with the `Id` property. This change enables the `RecActionView` entity to reference an optional `RecAction` entity, enhancing the data model and supporting entity relationships.
Introduced a `Profile` navigation property in the `RecActionView` class, linked to the `ProfileId` column using the `[ForeignKey]` attribute. The `Profile` property is nullable to support cases where no related `Profile` exists.
Added XML documentation to `OutResController` methods for clarity.
Introduced `ResultType` enum to specify result parts (Full, Header, Body).
Enhanced `Get` methods to support fake/test profiles and actions.
Added `[ProducesResponseType(StatusCodes.Status200OK)]` for explicit
response status codes. Updated `Get` overloads for various scenarios.
Utilized `config.GetFakeProfileId()` for dynamic fake profile handling.
Updated `Get` methods in `OutResController` to include a
`CancellationToken` parameter, enabling support for request
cancellation during asynchronous operations. Updated all
`mediator.Send` calls to propagate the `CancellationToken`.
Simplified the "fake/{actionId}" route by removing the explicit
assignment of `HttpContext.Response.ContentType` for non-
`ResultType.Full` cases.
Added new endpoints for invoking, retrieving, creating, and deleting
RecActions, including support for both specific and fake/test profiles.
Endpoints include:
- `Invoke` for batch invocation of RecActions.
- `Get` for retrieving RecActions by profile.
- `CreateAction` for creating new RecActions.
- `CreateFakeAction` for creating test RecActions.
- `Delete` for deleting RecActions by profile.
Enhanced all endpoints with XML documentation for clarity and added
`ProducesResponseType` attributes to specify expected HTTP status codes.
Replaced the `catch` block in the `JsonExtensions` class to suppress exceptions silently instead of returning the original string when JSON deserialization fails. The `return str;` statement was moved outside the `try-catch` block, making it the default return value. This change removes explicit handling of invalid JSON inputs and may impact debugging.
Refactored `ConfigExtensions.cs` to move `ConfigurationExtensions`
to the `ReC.API.Extensions` namespace and re-added the
`GetFakeProfileId` method. Introduced `JsonExtensions.cs` with
a `JsonToDynamic` method for recursive JSON deserialization,
simplifying nested JSON handling. Updated `OutResController.cs`
and `RecActionController.cs` to use the new `JsonToDynamic`
method, improving code readability and reducing duplication.
Overall, modularized and cleaned up code for better maintainability.
Introduced a new `HttpGet` endpoint `fake/{actionId}` in the
`OutResController` to support fetching OutRes data filtered
by `actionId` and an optional `resultType` parameter.
Added logic to handle different `resultType` values (`Full`,
`Header`, `Body`) and return the appropriate part of the
result. Updated response `ContentType` for non-`Full` results
and ensured null-safe handling for `Body` and `Header`.
Included a new `ResultType` enum and added necessary `using`
directives for the new functionality.
Reordered using directives in DtoMappingProfile.cs.
Added AutoMapper mapping for OutRes to OutResDto.
Modified ReadOutResQuery to return IEnumerable<OutResDto>.
Updated ReadOutResHandler to handle collection results:
- Changed Handle method to return IEnumerable<OutResDto>.
- Updated mapper.Map to map to a collection of OutResDto.
Updated `InvokeRecActionsCommandHandler` to use `IServiceScopeFactory` for creating scoped services. Replaced direct `IHttpClientFactory` usage with dynamic resolution of `ISender` within a service scope. Improved dependency injection adherence and ensured proper scoping of services. Added `Microsoft.Extensions.DependencyInjection` to `using` directives.
Replaced hardcoded FakeProfileId with a dynamic value retrieved
from the configuration using a new GetFakeProfileId extension
method. Updated OutResController and RecActionController to
inject IConfiguration and use the new method. Added a new
HttpGet endpoint in OutResController for fake profile queries.
Modified appsettings.json to include a FakeProfileId setting
with a default value of 2. Introduced ConfigurationExtensions
to centralize configuration access logic, improving code
maintainability and flexibility.
The validation rule in the `ReadOutResQueryValidator` class was updated to include a `WithName("Identifier")` call. This assigns a name ("Identifier") to the rule, improving the clarity and usability of validation error messages, especially in scenarios where multiple rules are applied and need to be distinguished.
Added a new asynchronous `Get` method to the `OutResController`
class in the `ReC.API.Controllers` namespace. This method handles
HTTP GET requests, accepts a `ReadOutResQuery` object as a query
parameter, and uses the `mediator` to process the query. The
result is returned in an HTTP 200 OK response. This change
enables retrieval of resources or data based on the provided
query parameters.
Updated `using` directives to include `DigitalData.Core.Exceptions` for custom exception handling. Renamed `dtos` to `resList` for clarity. Added a check to throw `NotFoundException` when no results are found in the query. Updated the return logic to ensure mapping occurs only when results exist. These changes enhance error handling and improve code robustness.
Introduced a new `OutResController` in the `ReC.API.Controllers`
namespace to handle API requests. The controller uses MediatR
for request handling and is decorated with `[ApiController]`
and `[Route("api/[controller]")]` attributes.
Added a `Get` method to process `ReadOutResQuery` objects
from query parameters and return the result via MediatR.
Included necessary `using` directives for dependencies.
Enhanced `ReadOutResHandler` to support filtering by `ProfileId`
when querying `OutRes` entities. This was implemented by adding
a condition to filter results based on the `ProfileId` of the
associated `Action`.
Updated the `OutRes` class to include a navigation property
`Action`, annotated with `[ForeignKey]` to link it to the
`ActionId` column. This establishes a relationship between
`OutRes` and `RecAction`, improving data access and maintainability.
Refactored `ReadOutResQuery` to a record type implementing
`IRequest<OutResDto>` for MediatR. Introduced `ReadOutResHandler`
to handle the query, leveraging `IRepository` and `IMapper` for
database access and mapping. Added support for filtering by
`ActionId` and asynchronous query execution. Streamlined design
by moving `ProfileId` and `ActionId` to immutable `init`
properties in the record.
Refactored `ExceptionHandlingMiddleware` to use `ValidationProblemDetails` for structured and consistent error responses. Marked the middleware as obsolete with a recommendation to use `DigitalData.Core.Exceptions.Middleware`. Updated exception handling logic to replace error message strings with detailed problem descriptions, including titles and details for each exception type. Improved the default case for unhandled exceptions with a user-friendly message. Enhanced response serialization using `WriteAsJsonAsync`.
Updated `ExceptionHandlingMiddleware` to enhance error handling:
- Added `Microsoft.AspNetCore.Mvc` and `System.Text.Json` for structured JSON responses.
- Made `message` nullable to handle cases without explicit messages.
- Refactored `ValidationException` handling:
- Changed HTTP status code from 422 to 400.
- Grouped validation errors by property and returned them in a `ValidationProblemDetails` object.
- Conditionally wrote `message` to the response only if not null.
- Improved structure and clarity of validation error responses.
Enhanced the `ExceptionHandlingMiddleware` to handle
`ValidationException` from the `FluentValidation` library.
Set HTTP status code to 422 (Unprocessable Entity) for
validation errors and constructed error messages by
aggregating validation error details. Improved error
response clarity for validation-related issues.
Introduced a validation pipeline using FluentValidation and
MediatR to enhance request validation. Added the following:
- Registered FluentValidation and MediatR dependencies in
`ReC.Application.csproj`.
- Updated `DependencyInjection.cs` to register validators
and MediatR behaviors, including `ValidationBehavior<,>`.
- Added `ValidationBehavior<TRequest, TResponse>` to handle
request validation in the MediatR pipeline.
- Created `ReadOutResQueryValidator` to enforce validation
rules for `ReadOutResQuery`.
- Refactored namespaces and imports for better organization.
These changes improve extensibility, maintainability, and
separation of concerns in the application.
Changed the `ProfileId` and `ActionId` properties in the
`ReadOutResQuery` class from non-nullable `long` to nullable
`long?`. This allows these properties to hold `null` values,
making them optional for scenarios where they are not always
required or applicable.
Added a new `OutResDto` record in the `ReC.Application.Common.Dto` namespace to represent output result data with properties like `Id`, `ActionId`, `Header`, `Body`, and audit fields.
Added a new `ReadOutResQuery` class in the `ReC.Application.OutResults.Queries` namespace to facilitate querying output results based on `ProfileId` and `ActionId`.
Reordered `using` directives for clarity and added `ReC.Domain.Entities`.
Added a `TODO` comment to indicate that `AddedWho` should be injected from the current host/user context.
Updated `CreateMap` in `MappingProfiles` to set `AddedWhen` to `DateTime.UtcNow` and `AddedWho` to the hardcoded value `"ReC.API"`.
Added a new HTTP POST endpoint `invoke/fake` in `RecActionController`
to invoke batch actions with a fake profile ID. Updated the `profileId`
parameter type in the `InvokeBatchRecAction` extension method from
`int` to `long` to support larger profile IDs. These changes improve
flexibility and introduce a new endpoint for specific use cases.
- Introduced `FakeProfileId` constant to replace hardcoded values.
- Added `HttpGet` endpoint `api/[controller]/fake` to retrieve data using `FakeProfileId`.
- Added `HttpPost` endpoint `api/[controller]/invoke/{profileId}` for batch actions.
- Updated `CreateAction` and `Delete` methods to use `FakeProfileId`.
- Added `HttpDelete` endpoint `api/[controller]/fake` to delete actions using `FakeProfileId`.
- Improved code maintainability by centralizing the fake profile ID and adding dedicated endpoints.
The `EndpointAuthId` property in the object initialization
within the `RecActionController` class was updated from `1`
to `4`. This change likely reflects an update to the
authentication configuration or a shift to a different
endpoint authorization identifier.
A new HTTP DELETE endpoint has been added to the
`RecActionController` class, accessible via the `"fake"` route.
The `Delete` method is asynchronous and uses the `mediator.Send`
method to execute a `DeleteRecActionsCommand` with a hardcoded
`ProfileId` value of `2`. The method returns an HTTP 204 No
Content response. This endpoint appears to be intended for
testing or placeholder purposes.
Introduced a new `EndpointAuthId` property in `RecActionController` and `CreateRecActionCommand` to enable handling of endpoint authentication. Updated the `RecActionController` to initialize `EndpointAuthId` with a default value of `1`. Modified the `CreateRecActionCommand` record to include a nullable `EndpointAuthId` property of type `long?`, allowing optional specification of authentication details.
A new `Sequence` property of type `byte` was added to the
`CreateRecActionCommand` record. It is initialized with a
default value of `1` and includes a `set` accessor, making
it mutable. This property allows the record to store or
manipulate sequence-related information, enhancing its
functionality.
Updated the `MappingProfile` class to include custom mappings for the `CreateRecActionCommand` to `RecAction` transformation:
- Set `Active` to `true` by default.
- Set `AddedWhen` to the current UTC time.
- Set `AddedWho` to `"ReC.API"` as a placeholder.
Added a `TODO` comment to replace the hardcoded `AddedWho` value with dynamic injection from the current host/user context.
Updated `CreateRecActionCommandHandler` to include a repository
dependency (`IRepository<RecAction>`) for persisting data. Added
a call to `repo.CreateAsync` in the `Handle` method to save the
command request. Updated `using` directives to include necessary
dependencies (`AutoMapper`, `DigitalData.Core.Abstraction.Application.Repository`,
and `ReC.Domain.Entities`). Validation logic for `EndpointId` or
`EndpointUri` remains unchanged.
Refactored the `RecActionController` to improve structure and
readability by introducing a `#region CRUD` section. Updated
the `HttpPost` route for invoking actions to `"invoke/{profileId}"`.
Added a new `CreateAction` method to handle action creation
and renamed the `HttpDelete` method from `GetActions` to
`Delete` for clarity. Introduced the `Invoke` method for batch
action invocation. Improved overall code organization and
maintainability.
Added a TODO comment to update `AddedWho` to be injected
from the current host/user context. Configured `AddedWhen`
to use the current UTC time (`DateTime.UtcNow`) and set
`AddedWho` to the string `"ReC.API"`.
Updated the `MappingProfile` class to configure the mapping
between `ObtainEndpointCommand` and `Endpoint` to explicitly
set the `Active` property of `Endpoint` to `true` using the
`ForMember` method. This ensures that the `Active` property
is initialized to `true` during the mapping process, aligning
with the intended default behavior for new `Endpoint` objects.
The conditional check in the `Handle` method of the
`ReadRecActionQueryHandler` class was updated. Previously, the code
threw a `NotFoundException` if the `actions` list was not empty
(`actions.Count != 0`). This logic was inverted to throw the exception
when the `actions` list is empty (`actions.Count == 0`).
This change ensures the exception is thrown only when no actions are
found for the given profile, aligning with the intended behavior
described in the exception message.
Updated `AddRecInfrastructure` to improve DbContext setup:
- Renamed parameters for clarity (`dbContextOpt` to `opt`).
- Renamed `connectionString` to `cnnStr` for consistency.
- Added `LogTo` for SQL query logging at `Trace` level.
- Enabled `EnableSensitiveDataLogging` for debugging.
- Enabled `EnableDetailedErrors` for detailed error messages.
Added advanced logging and debugging capabilities to the
DbContext configuration in `AddRecInfrastructure`:
- Integrated `ILogger<RecDbContext>` for logging.
- Enabled SQL query logging with `LogTo` at `Trace` level.
- Enabled sensitive data logging for debugging purposes.
- Enabled detailed error messages for better diagnostics.
Updated `ConfigureDbContext` to accept `IServiceProvider`, enabling dependency injection during database context setup. Modified `DependencyInjection.cs` to align with this change by updating `DbContextOptionsAction` and its related method signature.
Removed unused `System.IO` and `System.Text.Json` namespaces from `RecActionController.cs` to improve code cleanliness.
Updated `CreateAction`, `CreateFakeAction`, and `GetActions`
methods in `RecActionController` to include a `CancellationToken`
parameter. This enables handling of cancellation requests during
asynchronous operations. Updated `mediator.Send` calls to pass
the `CancellationToken`, improving responsiveness and resource
management.
Updated the `Invoke` method in `RecActionController` to accept a `CancellationToken` parameter, enabling cancellation handling during execution. Modified the `InvokeBatchRecAction` extension method in `InvokeBatchRecActionsCommandExtensions` to propagate the `CancellationToken` to the `sender.Send` method, ensuring cancellation support for batch action commands.
The `Get` method in `RecActionController` was updated to include a `CancellationToken` parameter, enabling support for operation cancellation. The `mediator.Send` call was modified to pass the token. No changes were made to the `Invoke` method or other unrelated parts of the class.
Added a new Get endpoint to RecActionController to fetch data
based on profileId using ReadRecActionQuery. Updated
ReadRecActionQuery to support long ProfileId, added a
parameterless constructor, and refactored its structure.
Adjusted ReadRecActionQueryHandler to align with these changes.
Changed the `Id` property in the `Profile` class from `short?` to `long` to support larger values and resolve a type mismatch with the `ProfileId` foreign key in the `RecAction` class.
Removed the `[NotMapped]` attribute from the `Profile` navigation property in `RecAction` as the type mismatch issue has been resolved. Also removed the related TODO comment. These changes improve database schema consistency and integrity.
Added `[Table]` attributes to `Connection`, `Endpoint`, `EndpointAuth`, and `Profile` classes to define database table mappings. Updated `Profile` with schema information.
Introduced a `Profile` navigation property in `RecAction` with a `[ForeignKey]` attribute to establish a relationship with the `Profile` entity. Temporarily marked it as `[NotMapped]` due to a foreign key type mismatch, with a `TODO` to resolve this in the future.
Included `System.ComponentModel.DataAnnotations.Schema` in `using` directives to support these changes.
Added a new "ConnectionStrings" section to the `appsettings.json`
file, including a "Default" connection string for SQL Server.
The connection string specifies the server, database, user
credentials, and options to disable encryption and trust the
server certificate. This change configures database connectivity
for the application.
Enhanced the DeleteRecActionsCommandHandler to include a check
for the existence of records before deletion, throwing a
NotFoundException if none are found. Made the Handle method
asynchronous and added necessary namespace imports for
exception handling and database operations. Added a comment
to suggest updating the DeleteAsync method in the Core library
to return the number of deleted records.
A new HTTP DELETE endpoint has been added to the `RecActionController` class. The endpoint, implemented as the `GetActions` method, accepts a `profileId` as a query parameter and uses the mediator pattern to send a `DeleteRecActionsCommand` with the provided `profileId`.
The method returns an HTTP 204 No Content response upon successful deletion, ensuring a clean separation of concerns and adherence to the CQRS pattern.
The `ActionController` class was removed and replaced with a new `RecActionController` class. The new class retains the same functionality, methods (`Invoke`, `CreateAction`, `CreateFakeAction`), and dependencies as the removed class.
The namespace (`ReC.API.Controllers`) and route attributes remain unchanged. Dependency injection for `IMediator` is preserved. This change is primarily a renaming of the controller to better align with its purpose while maintaining existing behavior.
Refactored the `CreateFakeAction` method in `ActionController`:
- Replaced individual parameters with a strongly-typed `FakeRequest` model for the request body.
- Added `[FromQuery]` attributes for `endpointUri`, `endpointPath`, and `type` to allow query parameter overrides.
- Updated serialization logic for `Body` and `Header` to handle null values more explicitly.
- Adjusted `BodyQuery` and `HeaderQuery` assignments to improve null handling.
Also updated `using` directives to include `ReC.API.Models` and `ReC.Application.RecActions.Commands`.
Introduced a new `FakeRequest` class in the `ReC.API.Models` namespace.
The class includes `Body` and `Header` properties, both of which
are nullable dictionaries with string keys and object values.
These properties are marked as `init`-only to ensure immutability
after initialization. This model is designed to support flexible
handling of request payloads and headers.
Updated the `AddOpenBehaviors` method call in `DependencyInjection.cs` to reflect changes in the `HeaderQueryBehavior` class, which now requires two generic type parameters instead of one. This ensures compatibility with the updated class definition.
Updated HeaderQueryBehavior to support two generic type
parameters, TRequest and TResponse, for improved flexibility.
Replaced the single TRecAction type parameter and Unit return
type with a more generic implementation. Updated where
constraints to reflect the new generic types. Modified the
Handle method signature and logic to align with the updated
generic parameters.
Modified the `AddOpenBehaviors` method in the `DependencyInjection` class to update `BodyQueryBehavior<>` to its two-type parameter version, `BodyQueryBehavior<,>`. The `HeaderQueryBehavior<>` remains unchanged.
Updated BodyQueryBehavior to support a generic request-response
pipeline. Replaced fixed `TRecAction` and `Unit` types with
`TRequest` and `TResponse` generics. Added `where` constraints
for `TRequest` (`RecActionDto`) and `TResponse` (`notnull`).
Updated the `Handle` method signature and return type to align
with the new generics.
The `MediatRLicense` key was removed from `appsettings.json`
and replaced with the `LuckyPennySoftwareLicenseKey`. This
change likely reflects a transition to a new licensing
mechanism. No other modifications were made to the file.
Updated `DtoMappingProfile` and `MappingProfiles` to explicitly inherit from `AutoMapper.Profile` for clarity. Added mapping configurations for `RecActionView` to `RecActionDto` and `CreateOutResCommand` to `OutRes` using `CreateMap` in their respective constructors.
Updated ActionController to support JSON serialization for
request body and headers in the CreateFakeAction method.
Replaced `bodyQuery` with `body` and `header` parameters,
serialized to JSON. Updated `BodyQuery` and added
`HeaderQuery` in `CreateRecActionCommand`. Refactored
endpoint URI construction and improved response handling.
Refactored ActionController to include IMediator dependency
in the constructor. Updated CreateFakeAction method to:
- Set a default value for `endpointUri`.
- Add an optional `endpointPath` parameter and logic to
construct a full URI.
- Include the `Active` property in CreateRecActionCommand.
- Ensure `endpointUri` is non-nullable.
Also added the `System.IO` namespace for potential future use.
Refactor `using` directives in `Program.cs` to include `ReC.API.Middleware` for middleware functionality.
Introduce `ExceptionHandlingMiddleware` to the HTTP request pipeline to handle exceptions globally. Suppress CS0618 warnings for its usage. No changes were made to the existing controller service configuration.
Enhanced the ExceptionHandlingMiddleware to handle
DataIntegrityException explicitly. Added a new `using`
directive for `ReC.Application.Common.Exceptions` to
support this change. When a DataIntegrityException is
caught, the middleware now sets the HTTP status code to
409 Conflict and returns the exception's message.
Also updated the default case to ensure unhandled
exceptions are logged and return a generic error message
with a 500 Internal Server Error status code.
Introduced `ExceptionHandlingMiddleware` to handle exceptions globally, log them, and return appropriate HTTP responses with JSON error messages.
- Added `HandleExceptionAsync` for exception processing.
- Handled `BadRequestException` (400) and `NotFoundException` (404).
- Included default handling for unhandled exceptions (500).
- Marked middleware as `[Obsolete]` with a note to use `DigitalData.Core.Exceptions.Middleware`.
- Added necessary `using` directives and XML documentation.
Updated CreateOutResCommandHandler to use the OutRes entity
instead of the command itself in repository operations. Added
a new using directive for ReC.Domain.Entities. Updated the
CreateOutResCommand class to implement MediatR's IRequest
interface.
The ActionController class was updated to include a new
CreateFakeAction endpoint. This endpoint accepts optional
parameters (endpointUri, type, and bodyQuery) and sends a
CreateRecActionCommand with hardcoded and default values.
The CreateRecActionCommand record was modified to remove
default values for ProfileId, Type, and BodyQuery. These
properties now require explicit initialization, with Type
and BodyQuery marked as non-nullable using the null! syntax.
These changes improve flexibility and add support for
creating "fake" actions via the new endpoint.
Simplified the `Handle` method by removing the `async` modifier
and replacing the `await` call with a direct `return` statement
for `repo.DeleteAsync`. This optimization eliminates the
overhead of creating an async state machine, as no additional
asynchronous operations or logic are performed in the method.
Introduced `DeleteRecActionsCommand` and its handler to enable
deletion of `RecAction` entities based on `ProfileId`. Added
necessary `using` directives and organized the code under the
`ReC.Application.RecActions.Commands` namespace. The handler
uses dependency injection for the repository and performs
asynchronous deletion with cancellation support.
A new HTTP POST endpoint `CreateAction` was added to the
`ActionController` class. This endpoint accepts a
`CreateRecActionCommand` object from the request body, sends
it to the `mediator` for processing, and returns a `201 Created`
response using the `CreatedAtAction` method. This change
enables the creation of actions via HTTP POST requests,
enhancing the controller's functionality.
Expanded RecDbContext to include new DbSet properties for
managing `Connections`, `Endpoints`, `EndpointAuths`,
`Profiles`, and `RecActions`. These additions enable
interaction with corresponding database tables/entities.
Updated the `OnModelCreating` method to ensure proper
configuration of the context. Removed an extraneous
closing brace to maintain proper syntax.
Introduced a new asynchronous `CreateAction` method in the
`ActionController` class to handle HTTP POST requests for
creating "rec actions". The method accepts a `CreateRecActionCommand`
object from the request body, processes it using `mediator.Send`,
and returns a `201 Created` response using `CreatedAtAction`.
Removed unused `using` directives for `DigitalData.Core.Abstraction.Application.Repository` and `ReC.Domain.Entities`. Reordered `using` directives for better organization. Updated the `ProfileId` property in `CreateRecActionCommand` to have a default value of `2`, improving code clarity and reducing the need for explicit initialization.
Introduced a new `MappingProfile` class in the `ReC.Application.RecActions` namespace to define object-to-object mapping configurations using AutoMapper.
The profile maps `CreateRecActionCommand` to `RecAction`, enabling seamless data transformation between these types. Added necessary `using` directives for `ReC.Application.RecActions.Commands` and `ReC.Domain.Entities`.
Replaced `GetOrCreateEndpointCommand` with `ObtainEndpointCommand`
to improve clarity and align with naming conventions. Removed
`GetOrCreateEndpointCommand` and its handler, and introduced
`ObtainEndpointCommand` with equivalent functionality.
Updated `MappingProfile.cs` to map `ObtainEndpointCommand` to
`Endpoint`. Refactored `CreateRecActionCommand.cs` to use the
new `ObtainEndpointCommand` for retrieving or creating `Endpoint`
entities.
These changes ensure consistent naming and maintain the same
behavior while improving code readability.
Renamed `GetOrCreateCommand` to `GetOrCreateEndpointCommand`
to improve clarity and consistency. Removed the old
`GetOrCreateCommand` class and handler, and introduced the
new `GetOrCreateEndpointCommand` class with equivalent
functionality.
Updated `MappingProfile` to reflect the new command name
and adjusted `CreateRecActionCommand` to use the renamed
command. Added the appropriate namespace for the new class
to ensure proper organization.
The `Id` property in the `Endpoint` class was changed from a
nullable `long?` to a non-nullable `long`. This ensures that
the `Id` property is always assigned a value and cannot be
`null`, improving data integrity and aligning with potential
database or application requirements.
Updated `CreateRecActionCommand` to implement `IRequest` for MediatR compatibility. Introduced `CreateRecActionCommandHandler` to process requests, including validation for `EndpointId` and `EndpointUri`. Added logic to fetch or create an endpoint when `EndpointUri` is provided. Updated `EndpointId` property to be mutable. Added necessary `using` directives and adjusted the namespace declaration.
Removed unused `using` directives across files for cleanup. Deleted `CreateEndpointCommand` and `Endpoint` classes as they are no longer needed. Added `GetOrCreateCommand` to handle endpoint retrieval or creation. Updated `MappingProfile` to remove mappings for `CreateEndpointCommand` and ensure proper inheritance from `AutoMapper.Profile`.
Refactored the `GetOrCreateCommand` to simplify the creation
of `Endpoint` entities by delegating the creation logic to
`repo.CreateAsync`.
Added a new `MappingProfile` class using AutoMapper to define
mappings between command objects (`CreateEndpointCommand` and
`GetOrCreateCommand`) and the `Endpoint` entity, improving
code maintainability and reducing boilerplate.
Included necessary `using` directives in `MappingProfile.cs`
to support the new mapping functionality.
Introduced the `CreateEndpointCommand` class as a placeholder for future implementation. Added the `Endpoint` class with properties `Active`, `Description`, and `Uri` to represent endpoint details. Included necessary `using` directives and organized the code under the `ReC.Application.Endpoints.Commands` namespace.
Introduced `GetOrCreateCommandHandler` to handle `GetOrCreateCommand` requests.
The handler checks if an `Endpoint` with the specified `Uri` exists in the repository
and returns it if found. If not, it creates a new `Endpoint`, saves it, and returns
the newly created object. Added necessary `using` directives for repository abstraction
and Entity Framework Core functionality.
Introduced the `GetOrCreateCommand` class in the `ReC.Application.Endpoints.Commands` namespace. This class implements the `IRequest<Endpoint>` interface from MediatR to handle requests for retrieving or creating an `Endpoint`.
Added `Uri` property to the command with an `init` accessor for immutability. Included necessary `using` directives for `MediatR` and `ReC.Domain.Entities`.
The `Guid` property in the `EndpointParam` class was renamed to `Id` to improve code readability and align with naming conventions. The `[Key]` and `[Column("GUID")]` attributes remain unchanged, ensuring the database schema mapping and primary key designation are preserved.
The `EndpointId` property in the `CreateRecActionCommand` class
was updated from a non-nullable `long` to a nullable `long?`
to allow it to hold `null` values.
Additionally, a new nullable `string?` property `EndpointUri`
was introduced to support specifying an optional endpoint URI.
Introduced a new namespace `ReC.Application.RecActions.Commands`
and added the `CreateRecActionCommand` record. This record
includes properties such as `ProfileId`, `Active`, `EndpointId`,
`Type`, `HeaderQuery`, and `BodyQuery` to encapsulate the
necessary data for creating RecActions. Default values were
provided for `Active`, `Type`, and `BodyQuery` to streamline
initialization.
Introduced a new `SqlConnection` property in the `RecAction` class, marked with the `[ForeignKey("SqlConnectionId")]` attribute. This establishes a foreign key relationship with the `SqlConnectionId` property, enabling ORM navigation between `RecAction` and the `Connection` entity.
The RecAction class in RecAction.cs now includes a new
navigation property, EndpointAuth, which is linked to the
EndpointAuthId column via the [ForeignKey] attribute. This
enhances the entity relationship by associating the
EndpointAuthId property with the EndpointAuth entity.
Enhanced the `RecAction` class by adding a navigation property
(`Endpoint`) to represent the relationship with the `Endpoint`
entity. Annotated the `Endpoint` property with the
`[ForeignKey("EndpointId")]` attribute to establish the foreign
key mapping. This improves the data model by explicitly defining
the relationship between `RecAction` and `Endpoint`.
Introduced a `Profile` navigation property to the `RecAction` class, annotated with `[ForeignKey("ProfileId")]`. This establishes a foreign key relationship between the `ProfileId` property and the `Profile` entity, enabling ORM navigation between `RecAction` and `Profile`.
The `ProfileName` property in the `Profile` class was renamed to `Name` to improve clarity or consistency. The `[Column("PROFILE_NAME")]` attribute remains unchanged, ensuring the database column mapping is unaffected.
Introduced a new `Profile` class in the `ReC.Domain.Entities` namespace to represent the `TBREC_CFG_PROFILE` table in the `dbo` schema.
- Added Entity Framework annotations to map properties to database columns.
- Defined properties for fields such as `Id`, `Active`, `Type`, `ProfileName`, `Description`, and others.
- Used nullable types for all properties to allow null values.
- Marked `Id` as the primary key with auto-generation enabled.
This change enables ORM support for managing profile-related data.
Introduce a new `Connection` class in the `ReC.Domain.Entities` namespace.
The class is mapped to the `TBDD_CONNECTION` database table and includes
properties for various columns such as `Id`, `Bezeichnung`, `SqlProvider`,
and others. Attributes like `[Key]`, `[Column]`, and `[DatabaseGenerated]`
are used for database mapping. Nullable types are used for all properties.
Added necessary `using` directives for annotations and schema mapping.
Introduced the `EndpointAuth` class in the `ReC.Domain.Entities` namespace to represent the `TBREC_CFG_ENDPOINT_AUTH` database table.
- Added Entity Framework annotations for table and column mappings.
- Defined properties for all table columns, including `Id`, `Active`, `Description`, `Type`, `ApiKey`, `ApiValue`, `ApiKeyAddTo`, `Token`, `Username`, `Password`, `Domain`, `Workstation`, `AddedWho`, `AddedWhen`, `ChangedWho`, and `ChangedWhen`.
- Configured `Id` as the primary key with auto-generated values.
Renamed the property `Guid` to `Id` in the `RecAction` class
to improve clarity and align with naming conventions or
database schema updates. No other changes were made to
the file.
Introduced a new `Endpoint` class in the `ReC.Domain.Entities` namespace to represent the `TBREC_CFG_ENDPOINT` database table.
- Added Entity Framework annotations to map properties to database columns.
- Defined properties for `Id`, `Active`, `Description`, `Uri`, `AddedWho`, `AddedWhen`, `ChangedWho`, and `ChangedWhen`.
- Configured `Id` as the primary key with auto-generated values.
Introduced the `RecAction` class in the `ReC.Domain.Entities`
namespace to represent the `TBREC_CFG_ACTION` database table.
Added data annotations for table and column mapping, including
a primary key (`Guid`) and other properties for database fields
such as `ProfileId`, `Active`, `Sequence`, and query-related
fields. Included auditing fields (`AddedWho`, `AddedWhen`,
`ChangedWho`, `ChangedWhen`) for tracking changes. All fields
are nullable to handle missing data gracefully.
Replaced `RecAction` with `RecActionView` across the codebase to align with the `VWREC_ACTION` database view. Updated mappings, interfaces, and repository registrations accordingly.
- Updated `DtoMappingProfile` to map `RecActionView` to `RecActionDto`.
- Modified `IRecDbContext` to use `DbSet<RecActionView>`.
- Refactored `ReadRecActionQueryHandler` to use `IRepository<RecActionView>`.
- Removed the `RecAction` class entirely.
- Updated `DependencyInjection` to register `RecActionView`.
- Adjusted `RecDbContext` to replace `RecAction` with `RecActionView` and configure it as a keyless entity.
- Introduced the `RecActionView` class, mirroring the structure of the removed `RecAction` class, with nullable properties for schema flexibility.
Cleaned up unused namespaces to improve code maintainability:
- Removed `System.Text.Json` from `CreateOutResCommand.cs`.
- Removed `Microsoft.Extensions.Logging` from `InvokeRecActionCommand.cs`.
This reduces unnecessary dependencies and improves readability.
The constructor of the `InvokeRecActionCommandHandler` class was updated to remove the optional `ILogger<InvokeRecActionsCommandHandler>? logger` parameter. This change simplifies the constructor by no longer requiring or accepting a logger instance.
Removed unused System.Text.Json dependency and the `EmptyJson` field. Updated `ActionId` to be required during initialization. Changed `Header` and `Body` properties to nullable strings without default values.
Introduce a new `DataIntegrityException` class to handle data
integrity issues. Replace the logging and early return for
`null` `RestType` in `InvokeRecActionCommandHandler` with
throwing the new exception. This ensures explicit error
handling and improves runtime issue detection.
Updated the `Action` property in the `InvokeRecActionCommand` class
to be non-nullable by initializing it with a default value (`= null!;`).
This change ensures better null safety and prevents potential null
reference issues. The `= null!;` syntax suppresses compiler warnings
while guaranteeing the property will be properly initialized before use.
Updated the `ActionId` property to `Id` in `RecActionDto`
and `RecAction` classes for consistency. Reflected this
change in all relevant files, including log messages,
property assignments, and database column mappings.
Standardized naming conventions to improve code clarity
and maintainability.
Refactored `InvokeRecActionCommand` to remove inheritance from
`RecActionDto` and introduced a new `Action` property to
encapsulate the data. Updated the `ToInvokeCommand` extension
method to align with this change.
Modified `InvokeRecActionCommandHandler` to reference the
`Action` property instead of directly accessing inherited
properties. Updated HTTP request creation logic and the
`CreateOutResCommand` instantiation to use the `Action` object.
This change improves code clarity and adheres to composition
over inheritance principles.
Updated the `RecActionDto`, `RecAction`, and `InvokeRecActionCommandHandler` to enforce `ActionId` as a required field. This change improves data integrity by removing nullable `ActionId` properties and eliminates the need for null checks or null-forgiveness operators.
Enhanced InvokeRecActionCommandHandler to send a
CreateOutResCommand after processing HTTP responses.
Added dependencies for configuration and command handling.
Updated the constructor to include ISender and optional
IConfiguration for improved extensibility.
Integrated MediatR for command handling by modifying the
CreateOutResCommand class to implement the IRequest interface.
Added a static EmptyJson property for default JSON serialization
and updated Header and Body properties to use it. Introduced
CreateOutResCommandHandler to handle command creation using
IRepository asynchronously.
Introduced a new `MappingProfiles` class in the `ReC.Application.OutResults` namespace to configure object-object mapping using the `AutoMapper` library.
Added a mapping configuration between `CreateOutResCommand` and `OutRes` using the `CreateMap` method. This simplifies data transformation between application layers.
Renamed the `ResultHeader` and `ResultBody` properties to `Header`
and `Body` in both `CreateOutResCommand` and `OutRes` classes
to improve naming consistency. Default values and database
column mappings remain unchanged.
Introduced the `CreateOutResCommand` class in the `ReC.Application.OutResults.Commands` namespace. This class includes properties for managing output results, such as `ActionId`, `ResultHeader`, `ResultBody`, and `AddedWho`. Added a static readonly `EmptyJson` property for initializing JSON fields with a serialized empty object. Included `System.Text.Json` for JSON serialization functionality.
Renamed variables `body` to `resBody` and `headers` to `resHeaders`
to improve clarity and better reflect their association with the
response object. These changes enhance code readability and
maintainability without altering functionality.
Simplified the codebase by removing `BodyQueryExecuted`,
`HeaderQueryExecuted`, and related computed properties
(`IsBodyQueryReturnedNoData` and `IsHeaderQueryReturnedNoData`)
from `RecActionDto`. These properties were used to track
whether `BodyQuery` and `HeaderQuery` were executed and
whether they returned data.
Updated `BodyQueryBehavior` and `HeaderQueryBehavior` to
remove logic that set these properties. Also removed the
conditional block in `InvokeRecActionCommandHandler` that
logged warnings based on these properties.
These changes streamline the code and reflect a shift away
from tracking query execution and results at this level.
Refactored `BodyQueryBehavior` and `HeaderQueryBehavior` to introduce explicit execution tracking with new properties (`BodyQueryExecuted` and `HeaderQueryExecuted`). Updated `RecActionDto` to include computed properties (`IsBodyQueryReturnedNoData` and `IsHeaderQueryReturnedNoData`) for clearer null-checking logic. Removed the `IsReturnedNoData` tuple for simplicity.
Updated `InvokeRecActionCommandHandler` to use the new `IsBodyQueryReturnedNoData` property. Improved logging for better diagnostics and clarified handling of null results in query behaviors.
Improved robustness and error handling in `BodyQueryBehavior`
and `HeaderQueryBehavior` by adding null checks, logging,
and introducing the `IsReturnedNoData` flag to track query
results. Updated `RecActionDto` to include the new flag for
better state management. Enhanced HTTP request construction
in `InvokeRecActionCommand` to handle `Body` and `Headers`
more reliably and log potential issues with unexecuted
behaviors. These changes improve resilience, traceability,
and diagnostics across the application.
Enhanced HTTP request handling by adding support for dynamically including custom headers from the `request.Headers` collection. Implemented a null check to ensure robustness and prevent null reference exceptions when processing headers. This change improves flexibility and customization of HTTP requests.
Improve observability by adding a warning log when `request.BodyQuery` is not null but `request.IsReturnedNoData.BodyQuery` is false.
The log message highlights potential issues, such as skipped `BodyQueryBehavior` execution or missing control steps, and includes `ProfileId` and `ActionId` for better debugging context.
Updated HeaderQueryBehavior to handle null or missing
REQUEST_HEADER gracefully by logging warnings and setting
action.IsReturnedNoData.HeaderQuery to true instead of
throwing exceptions. Enhanced log messages for failed
RawHeader deserialization to improve clarity and added
pipeline continuity by calling await next(cancel).
Refactored log formatting for consistency.
Added `IsReturnedNoData` property as a tuple to track the state
of `BodyQuery` and `HeaderQuery` data returns. Introduced
`PostprocessingQuery` property to support initialization of
post-processing queries. These changes enhance the functionality
of the `RecActionDto` class by enabling better query handling
and processing capabilities.
Previously, the code continued execution when the RawHeader
property of the query result was null. This change introduces
an InvalidOperationException to handle this case, ensuring
that the absence of a valid RawHeader is treated as an error.
The exception message includes ProfileId and ActionId for
better debugging context.
Simplified null-checks in the `Handle` method of the
`BodyQueryBehavior` class using the null-conditional operator.
Enhanced the exception message to include `ProfileId` and
`ActionId` for better debugging context when `result?.RawBody`
is null.
Previously, the `Handle` method in `BodyQueryBehavior<TRecAction>`
did not validate the `BodyQuery` result before setting `action.Body`.
This change introduces a check to ensure that the result and its
`RawBody` are not null. If either is null, an
`InvalidOperationException` is thrown with a clear error message.
This ensures `action.Body` is only set when a valid result is
retrieved, improving robustness and preventing potential null
reference issues.
Added logic to handle non-null `request.Body` in HTTP requests.
Introduced a `StringContent` object to encapsulate the body
content and assigned it to the `Content` property of the
HTTP request. This ensures that the request body is included
when sending data to the specified endpoint.
Replaced FirstOrDefaultAsync with SingleOrDefaultAsync in
BodyQueryBehavior.cs and HeaderQueryBehavior.cs to enforce
that database queries return at most one result. This change
ensures an exception is thrown if multiple results are found,
making debugging and error handling more explicit.
2025-11-28 12:19:40 +01:00
133 changed files with 4558 additions and 484 deletions
varaddedWho=config["AddedWho"]??thrownewInvalidOperationException("The required 'AddedWho' configuration is missing. Please contact a system administrator.");
logger?.LogWarning("Header query did not return a result or returned a null REQUEST_HEADER. Profile ID: {ProfileId}, Action ID: {Id}",action.ProfileId,action.Id);
.WithMessage("The 'AddedWho' field is required. A missing value may indicate an API configuration issue. Please contact your system administrator for assistance.");
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.