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.