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.