Commit Graph

753 Commits

Author SHA1 Message Date
47698b9046 Rename ToStatus to ToRecStatus for HttpStatusCode conversion
Standardize extension method naming by renaming ToStatus to ToRecStatus for converting HttpStatusCode to RecStatus across the codebase. Updated all usages and related tests for consistency and clarity.
2026-03-30 11:40:26 +02:00
a03d21ebc6 Rename StatusExtensions to RecStatusExtensions for clarity
Renamed the StatusExtensions class and related XML documentation references to RecStatusExtensions to better reflect its association with the RecStatus enum and improve code clarity and consistency.
2026-03-30 11:39:37 +02:00
acff0aca89 Rename Status enum to RecStatus across the codebase
Refactored all usages of the Status enum to RecStatus to improve clarity and prevent naming conflicts with other status enums (e.g., HTTP status codes). Updated command handlers, behaviors, data models, and extension methods to use RecStatus, and adjusted related serialization logic accordingly. This makes the domain-specific status handling more explicit and maintainable.
2026-03-30 11:35:22 +02:00
ce0e53baf6 Update test for InsertResultCommand Status property change
Refactored InsertResultProcedure_runs_via_mediator to use the new Status property (set via HttpStatusCode.OK.ToStatus()) instead of the old StatusId integer. Added necessary using directives to support updated types and methods.
2026-03-30 11:33:42 +02:00
620c0eff22 Add ToStatus extension for HttpStatusCode to Status conversion
Introduced a ToStatus extension method in StatusExtensions to enable direct conversion from HttpStatusCode to Status by casting. This simplifies mapping between HTTP status codes and internal Status values.
2026-03-30 11:33:28 +02:00
68f4486fa1 Make Status required in InsertResultCommand
Changed the Status property in InsertResultCommand from nullable to required, ensuring that a Status value must always be provided when creating an instance. This improves data integrity and prevents accidental omission of the Status field.
2026-03-30 11:33:08 +02:00
2b5e63cb45 Update result status handling in InsertResultCommand
Replaced StatusId with Status property in InsertResultCommand, mapping HTTP status codes to application-specific status enums using ToStatus(). Exception handling now sets Status to QueryFailed. Removed usage of StatusId.
2026-03-30 11:22:57 +02:00
e9e697fa0d Update to use Result.Status instead of StatusId in insert proc
Changed the parameter for "pRESULT_STATUS_ID" from request.Result?.StatusId to request.Result?.Status in InsertObjectProcedureHandler. This aligns with updates to the data model or business logic, ensuring the correct status property is used when inserting objects.
2026-03-30 11:22:27 +02:00
606eccb855 Add Status to InsertResultCommand for query outcome reporting
Enhance PostprocessingBehavior and PreprocessingBehavior to set the Status property on InsertResultCommand. Status is now set to QuerySuccess on successful execution and QueryFailed on exceptions, improving clarity of query execution results.
2026-03-30 11:11:51 +02:00
3146acfa45 Refactor InsertResultCommand to use Status enum
Replaced StatusId (short?) with Status (Status?) in InsertResultCommand, moving from a numeric status identifier to a more descriptive or structured status representation from ReC.Domain.Constants.
2026-03-30 11:11:28 +02:00
f363872e7a Refactor ResultView: replace StatusCode with Status object
Replaced the short? StatusCode property in ResultView with a Status object to provide a more descriptive representation of status information. This change improves code clarity and supports richer status handling.
2026-03-30 10:51:58 +02:00
ed4683323d Change Status enum underlying type to short
Explicitly set the Status enum's underlying type to short instead of the default int to optimize memory usage and clarify intent. No other changes were made.
2026-03-30 10:50:33 +02:00
4aeef10ef7 Add StatusExtensions with HTTP status mapping methods
Added StatusExtensions.cs with extension methods for Status and HttpStatusCode:
- ToHttpStatusCode maps Status to nullable HttpStatusCode if possible.
- IsSuccess checks if a Status or HttpStatusCode represents a successful response.
- Handles both direct Status values and those convertible to HTTP codes.
2026-03-30 10:41:39 +02:00
e04e90d8c6 Add Status enum for HTTP and SQL operation status codes
Introduced Status enum in ReC.Domain.Constants to unify status reporting for both HTTP responses and SQL query execution results. The enum includes all standard HTTP status codes and custom codes for SQL query success/failure, with detailed documentation for each value. This standardizes status handling across web and database operations.
2026-03-30 10:41:09 +02:00
93b5f976d3 Refactor stored procedure SQL construction and execution
Centralize stored procedure SQL generation in StoredProcedureBuilder,
allowing handlers to specify procedure name and return variable.
Removes manual SQL string building from DeleteObjectProcedure and
UpdateObjectProcedure handlers, reducing boilerplate and improving
maintainability.
2026-03-30 09:30:07 +02:00
b66a49f74d Refactor: add StoredProcedureBuilder for SQL calls
Introduce StoredProcedureBuilder to centralize and simplify the construction of SQL stored procedure calls and parameter lists. Refactor DeleteObjectProcedureHandler, InsertObjectProcedureHandler, and UpdateObjectProcedureHandler to use this utility, replacing manual StringBuilder and parameter management. Improves code readability, reduces duplication, and standardizes parameter handling, including output parameters.
2026-03-27 15:11:16 +01:00
70dc52139d Refactor SQL param and command construction in procedures
Refactored InsertObject, UpdateObject, and DeleteObject procedure handlers to dynamically build SQL command strings and parameter lists. Introduced local Add functions to include only non-null parameters, improving code clarity and reducing unnecessary SQL parameter passing. The logic for handling stored procedure results and exceptions remains unchanged.
2026-03-27 14:58:56 +01:00
210ed9be8d Refactor SQL construction with StringBuilder for clarity
Refactored DeleteObjectProcedureHandler, InsertObjectProcedureHandler, and UpdateObjectProcedureHandler to use StringBuilder for building SQL command strings. This improves readability and maintainability without changing the logic or parameters. Added System.Text using directives as needed.
2026-03-27 14:54:27 +01:00
b2544b64e3 Refactor: use named params in SP calls, cleanup usings
Updated Delete, Insert, and Update object procedure handlers to use named parameters in SQL stored procedure calls instead of positional parameters, improving clarity and reducing risk of misalignment. Also removed unused using statements from UpdateObjectProcedure.cs.
2026-03-27 14:21:45 +01:00
0b1e0d25ca Explicitly set SqlDbType.TinyInt for relevant SQL parameters
Updated InsertObjectProcedureHandler and UpdateObjectProcedureHandler to explicitly specify SqlDbType.TinyInt for parameters representing TINYINT columns. Also improved handling of nullable and enum values for these parameters to ensure correct type casting and null handling. This enhances type safety and prevents potential SQL type conversion issues.
2026-03-27 14:19:19 +01:00
c1027abfc6 Specify SqlDbType.SmallInt for relevant SqlParameters
Explicitly set SqlDbType.SmallInt for parameters related to small integer fields in UpdateObjectProcedureHandler. This improves type safety and prevents potential data conversion issues by ensuring correct parameter types are sent to SQL Server.
2026-03-27 13:30:28 +01:00
40c8fa359c Specify SqlDbType.SmallInt for relevant SqlParameters
Explicitly set SqlDbType.SmallInt for parameters related to endpoint params, SQL connection, profile language, and endpoint params group. This ensures correct type handling and prevents potential data conversion issues with the database.
2026-03-27 13:29:43 +01:00
1375f5f0e4 Set @pRESULT_STATUS_ID param type to SmallInt explicitly
Explicitly specify SqlDbType.SmallInt for the @pRESULT_STATUS_ID parameter when calling the stored procedure. This change ensures correct type handling and helps prevent potential SQL type mismatches or conversion errors.
2026-03-27 13:13:36 +01:00
29bc0cf8b5 Relax RESULT validation to allow StatusId, Info, or Error
Previously, RESULT required a non-null StatusId. Now, validation passes if at least one of StatusId, Info, or Error is provided, making the requirements more flexible.
2026-03-27 09:46:43 +01:00
c8b264cef6 Improve null safety in InsertObjectProcedureValidator
Updated validation logic to use null-forgiving operators and added null checks for nested properties in When clauses. This ensures rules are only applied when parent objects are not null, preventing possible null reference errors and improving overall robustness.
2026-03-27 09:40:33 +01:00
078525d85d Refactor RecAction invoke endpoint to use profileId param
Changed the HTTP POST route to accept a profileId instead of a command object, updated XML documentation accordingly, and refactored the method to construct the command internally using the provided profileId before sending it to the mediator. This improves clarity and API usability.
2026-03-27 09:26:13 +01:00
b3dfdd1e5c Update namespaces to Common.Dto for DTO-related files
Refactored PlaceholderExtensions, DtoMappingProfile, and InvokeActionTests
to use the ReC.Application.Common.Dto namespace instead of
ReC.Application.Common.Behaviors.Action. Updated using directives and
namespaces to improve code organization for DTO-related logic.
2026-03-26 16:52:54 +01:00
bd78ada686 Remove all DTO class definitions from application
Deleted the contents of several DTO files, including ConnectionDto, EndpointAuthDto, EndpointDto, EndpointParamDto, OutResDto, ProfileDto, and RecActionDto. These files previously contained record definitions for data transfer objects used throughout the application. All related code, including properties and using directives, has been removed, leaving the files empty.
2026-03-26 15:48:49 +01:00
2b4773a4c0 Remove Root and ActionId from ResultViewDto
Removed the Root (OutResDto?) and ActionId (long?) properties from the ResultViewDto record to simplify its structure and remove unused fields.
2026-03-26 15:48:35 +01:00
ff7d6c99ae Update RecActionViewDto mapping and add Profile property
Refactored DtoMappingProfile to pass both the source object and its Profile to ReplacePlaceholders when mapping queries. Added a nullable Profile property to RecActionViewDto to include full profile details in the DTO.
2026-03-26 15:48:06 +01:00
fa438e70cb Allow ReplacePlaceholders to handle null objects safely
Updated ReplacePlaceholders to accept nullable objects and skip nulls during placeholder resolution, preventing NullReferenceExceptions when nulls are passed in the objects array.
2026-03-26 15:32:00 +01:00
4931d3b8aa Map queries with placeholders replaced in DTOs
Updated RecActionView to RecActionViewDto mapping to replace placeholders in PreprocessingQuery and PostprocessingQuery using ReplacePlaceholders. Added necessary using directive for the extension method.
2026-03-26 15:28:08 +01:00
6aae26bfb6 Update using directive to new Action namespace
Replaced the using directive for InvokeAction with Action in InvokeActionTests.cs to reflect recent namespace reorganization. No other changes were made.
2026-03-26 15:23:30 +01:00
38d8ef6e93 Update namespace in PlaceholderExtensions.cs
Changed namespace from ReC.Application.Common.Behaviors.InvokeAction to ReC.Application.Common.Behaviors.Action for consistency. No other code changes were made.
2026-03-26 14:58:01 +01:00
7bc5428bd4 Refactor: move query behaviors to Action namespace
Updated the namespaces for BodyQueryBehavior and HeaderQueryBehavior from ReC.Application.Common.Behaviors to ReC.Application.Common.Behaviors.Action. Adjusted related imports in DependencyInjection.cs to reflect this change for improved code organization.
2026-03-26 14:40:50 +01:00
c405f369ac Add unit tests for InvokeAction placeholder replacement
Introduce InvokeActionTests.cs with comprehensive tests for:
- Placeholder replacement logic (ReplacePlaceholders) across int, bool, string, DateTime, DateTimeOffset types, multiple placeholders, and various prefix formats.
- Value extraction by column name (GetValueByColumnName), including models with and without [Column] attributes.
- Exception handling for unresolvable placeholders and invalid input scenarios.
These tests ensure robust coverage of both normal and error cases.
2026-03-26 14:37:58 +01:00
c2e073dade Add ReplacePlaceholders for SQL-style string interpolation
Introduce ReplacePlaceholders to PlaceholderExtensions, enabling replacement of {#...#COLUMN_NAME} placeholders in strings with property values from provided objects. Uses a generated regex for matching and converts values to SQL-compatible literals. Throws PlaceholderResolutionException if a column cannot be resolved. Refactored class to partial to support regex generation.
2026-03-26 14:37:29 +01:00
7a11ac3635 Add PlaceholderResolutionException for unresolved placeholders
Introduced PlaceholderResolutionException in the ReC.Application.Common.Exceptions namespace. This exception provides detailed context when a placeholder cannot be resolved due to a missing property with a specific column name, including the placeholder, column name, and input string.
2026-03-26 14:36:35 +01:00
a91e3264b4 Remove Action folder reference from project file
The <Folder Include="Common\Behaviors\Action\" /> entry was removed from ReC.Application.csproj, so the folder is no longer explicitly included in the project structure. No code or project references were affected.
2026-03-26 14:35:39 +01:00
2ae5251550 Rename class and update namespace for placeholder logic
Renamed the ReflectionExtensions class to PlaceholderExtensions and moved it from the ReC.Domain.Extensions namespace to ReC.Application.Common.Behaviors.InvokeAction to better reflect its purpose and location within the project structure.
2026-03-26 13:48:16 +01:00
56730c0d4e Make GetValueByColumnName a generic extension method
Refactored GetValueByColumnName to use a generic type parameter constrained to class types. This enhances type safety and enables better type inference and static analysis when accessing property values by column name.
2026-03-26 13:42:45 +01:00
d8aa032a57 Add ReflectionExtensions for property lookup by column name
Introduced a static ReflectionExtensions class with a GetValueByColumnName extension method to retrieve property values by their [Column] attribute name. Also removed an unused folder reference from the project file.
2026-03-26 13:16:04 +01:00
e96773f3c4 Remove DbModelConfigurationException and related logic
Removed the DbModelConfigurationException class and all its usages from DbModelOptions and EntityOptions. Indexers in these classes no longer throw this exception when configuration is missing. Updated the project file to include the Common\Options\DbModel\ folder.
2026-03-26 10:34:24 +01:00
06e92b588f Remove DbModel configuration and related JSON file
Removed all references to DbModel configuration from Program.cs and RecApplicationTestBase.cs. Deleted appsettings.DbModel.json, eliminating custom entity and column mapping definitions. The application no longer loads or uses DbModel configuration from JSON.
2026-03-26 10:34:05 +01:00
b922cbbb30 Remove ConfigureDbModel from dependency injection setup
Eliminated all references to ConfigureDbModel in DependencyInjection.cs, including related imports, configuration methods, and required service tracking. Dependency injection configuration is otherwise unchanged.
2026-03-26 10:32:24 +01:00
6c56375e3e Refactor RecDbContext to remove dynamic view mapping
Removed dependency on DbModelOptions and IOptions. Entity-to-view mappings are now hardcoded in OnModelCreating with fixed view names and schema. Property-to-column mappings now use EF Core conventions. Simplifies configuration and maintenance, but reduces flexibility for schema changes. Entity relationships remain explicitly configured.
2026-03-26 10:31:48 +01:00
fa9aa23f32 Add EF Core data annotations to view models
Added [Key], [Column], and [Table] attributes to ProfileView, RecActionView, and ResultView classes to explicitly map properties to database columns and views. Expanded model properties for clearer schema alignment and improved maintainability with Entity Framework Core.
2026-03-26 10:30:00 +01:00
b86d0c0f99 Add [Column] mapping attributes to query result classes
Added [Column] attributes to properties in BodyQueryResult, HeaderQueryResult, and InsertObjectResult to explicitly map them to their respective database columns. Also included necessary using directives for DataAnnotations.Schema to support these mappings. This enhances ORM compatibility and ensures correct property-to-column mapping.
2026-03-26 10:28:52 +01:00
b0d89ceba4 Remove properties from RecActionOptions class
Removed AddedWho and UseHttp1ForNtlm properties from RecActionOptions, leaving the class empty. This change cleans up unused configuration options.
2026-03-25 16:13:32 +01:00
11ebfdd21e Refactor DbModelOptions to use indexers for lookups
Replaced GetEntity and GetColumn extension methods with indexers
on DbModelOptions and EntityOptions. Updated all usages to use
the new indexer syntax, improving code clarity and error handling
for missing entity or column configurations.
2026-03-25 16:10:50 +01:00