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.