223 Commits

Author SHA1 Message Date
5ba012cc13 Refactor infrastructure service setup
Renamed `AddInfrastructureServices` to `AddRecInfrastructure`
in both generic and non-generic forms to standardize naming
and improve clarity. Updated `Program.cs` to use the new
method, adding database context configuration with a
connection string from the app's configuration.

Added a constraint to `AddRecInfrastructure<TRecDbContext>`
requiring `TRecDbContext` to inherit from `RecDbContext`.
Refactored the method to register entities from the assembly
containing `RecAction`. Removed the old
`AddInfrastructureServices` method entirely.
2025-11-25 16:55:04 +01:00
89879d0821 Add services and update project configuration
Added `AddRecServices` and `AddInfrastructureServices` to `Program.cs` with necessary configurations. Updated `ReC.API.csproj` to include project references to `ReC.Application` and `ReC.Infrastructure`, and fixed an encoding issue by adding a BOM. Modified `appsettings.json` to include `MediatRLicense` and adjusted `AllowedHosts` format. Ensured `TargetFramework` and other project properties remain unchanged.
2025-11-25 16:52:21 +01:00
d62175f6ec Make LuckyPennySoftwareLicenseKey nullable
Updated the `LuckyPennySoftwareLicenseKey` property in the
`ConfigurationOptions` class to allow null values by changing
it from a non-nullable string with a default value of an empty
string to a nullable string (`string?`). This change enables
explicit representation of the absence of a license key using
`null` instead of an empty string.
2025-11-25 16:37:37 +01:00
a6cb0081ee Add DependencyInjection class for service registration
Introduced a new `DependencyInjection` class in the `ReC.Application` namespace to streamline service registration.

- Added `AddRecServices` extension method for `IServiceCollection` to configure AutoMapper and MediatR with assembly scanning.
- Included `ConfigurationOptions` class to allow configuration of a `LuckyPennySoftwareLicenseKey`.
- Added `using` directives for `Microsoft.Extensions.DependencyInjection` and `System.Reflection` to support dependency injection and assembly scanning.
2025-11-25 16:33:18 +01:00
7214b09640 Add AutoMapper and MediatR; implement DtoMappingProfile
Added `AutoMapper` and `MediatR` NuGet packages to the
`ReC.Application.csproj` file to include these libraries as
dependencies.

Created a `DtoMappingProfile` class in the `ReC.Application.Dto`
namespace to define a mapping configuration between the `RecAction`
entity and the `RecActionDto` data transfer object using `AutoMapper`.

Included necessary `using` directives for `AutoMapper` and
`ReC.Domain.Entities` in the `DtoMappingProfile.cs` file to enable
the mapping functionality.

These changes improve maintainability by automating object-to-object
mapping and prepare the project for potential use of the mediator
pattern with `MediatR`.
2025-11-25 15:38:53 +01:00
21d09df037 Add MediatR, RecActionDto, and ReadRecActionQuery
Added the `MediatR` NuGet package (v13.1.0) to enable the mediator pattern. Updated `ReC.Application.csproj` to include a project reference to `ReC.Domain`.

Introduced `RecActionDto` as a Data Transfer Object (DTO) for representing "RecAction" details, including properties for endpoints, authentication, and SQL connections.

Added `ReadRecActionQuery` to handle queries for retrieving `RecActionDto` objects, leveraging MediatR. This query filters results based on `ProfileId`.
2025-11-25 15:33:32 +01:00
eab38f1e34 Integrate EF Core with SQL Server and Infrastructure
Added `Microsoft.EntityFrameworkCore` and `ReC.Infrastructure` namespaces to `Program.cs` to enable EF Core functionality and infrastructure services. Configured the database context with a connection string from the app's configuration and added error handling for missing connection strings.

Updated `ReC.API.csproj` to include the `Microsoft.EntityFrameworkCore.SqlServer` NuGet package (v9.0.11) for SQL Server support. Added a project reference to `ReC.Infrastructure` to enable the API project to use the infrastructure layer.
2025-11-25 15:20:09 +01:00
e552658d2e Support generic DbContext in AddInfrastructureServices
Updated AddInfrastructureServices to support a generic
TRecDbContext type parameter, enabling the use of custom
DbContext types. Modified AddDbContext and AddDbRepository
to use the generic TRecDbContext type. Added an overload
of AddInfrastructureServices that defaults to RecDbContext
for backward compatibility. These changes enhance flexibility
and reusability while maintaining compatibility with existing
implementations.
2025-11-25 15:11:47 +01:00
d902cfb756 Enhance DI with repository registration support
Added `DigitalData.Core.Infrastructure` dependency and updated the `DependencyInjection` class to include `services.AddDbRepository` for dynamic repository registration from the `RecAction` assembly. Updated `ReC.Infrastructure.csproj` to include the new package reference. Improved dependency injection setup for better repository management.
2025-11-25 15:10:05 +01:00
cae3ec31c4 Add DI support for RecDbContext with configuration options
Introduced a `DependencyInjection` class with an extension
method `AddInfrastructureServices` to register `RecDbContext`
using configurable `DbContextOptions`. Added a `ConfigurationOptions`
class to encapsulate `DbContext` configuration.

Validated that `DbContextOptionsAction` is provided before
registration. Updated `ReC.Infrastructure.csproj` to include
`Microsoft.Extensions.Configuration.Abstractions` for enhanced
configuration support. Added necessary `using` directives.
2025-11-25 15:03:58 +01:00
1e22e4d851 Refactor Action class to RecAction
Replaced the `Action` class with a new `RecAction` class to represent the `VWREC_ACTION` database view. The `RecAction` class retains the same properties and annotations as the removed `Action` class, ensuring compatibility with the database schema.

Updated `RecDbContext` to use `RecAction`:
- Replaced `DbSet<Domain.Entities.Action>` with `DbSet<RecAction>`.
- Updated the `OnModelCreating` configuration to use `RecAction`.

This refactor improves clarity, aligns with naming conventions, and prepares the codebase for future changes.
2025-11-25 14:16:41 +01:00
163b5bc2f9 Add EF Core and RecDbContext for database integration
Added the `Microsoft.EntityFrameworkCore` NuGet package to the
`ReC.Infrastructure` project to enable database functionality.
Introduced `RecDbContext` with `DbSet` properties for `EndpointParam`,
`Action`, and `OutRes` entities. Configured `Action` as a keyless
entity in `OnModelCreating`. Added a project reference to
`ReC.Domain` to use domain entities in the infrastructure layer.
2025-11-25 14:15:06 +01:00
b94a620389 Rename Trigger method to Invoke in ActionController
The `Trigger` method in the `ActionController` class was renamed to `Invoke`. This change updates the HTTP POST endpoint that accepts a `profileId` as a route parameter. The method's functionality remains unchanged, as it still throws a `NotImplementedException`.
2025-11-25 13:44:31 +01:00
2af140db96 Add OutRes entity mapped to TBREC_OUT_RESULT table
A new `OutRes` class was added to represent the `TBREC_OUT_RESULT` table in the `dbo` schema. The class includes properties for `Id`, `ActionId`, `ResultHeader`, `ResultBody`, `AddedWho`, `AddedWhen`, `ChangedWho`, and `ChangedWhen`, all mapped to corresponding database columns using data annotations. The `System.ComponentModel.DataAnnotations` and `System.ComponentModel.DataAnnotations.Schema` namespaces were imported to support this configuration.
2025-11-25 13:38:47 +01:00
304970f47a Rename class VwRecAction to Action
Renamed the class `VwRecAction` to `Action` to simplify the name
and better align with naming conventions. The `[Table]` attribute
mapping to `VWREC_ACTION` in the `dbo` schema remains unchanged.
Class properties such as `ActionId` and `ProfileId` are unaffected
by this change.
2025-11-25 10:32:17 +01:00
c33144ad7b Add EndpointParam entity for database table mapping
Introduced the `EndpointParam` class to represent the `TBREC_CFG_ENDPOINT_PARAMS` table in the database.

- Added `using` directives for data annotations and table mapping.
- Defined properties to map to table columns, all nullable for flexibility.
- Annotated the class with `[Table]` and properties with `[Column]` attributes.
- Marked `Guid` as the primary key using the `[Key]` attribute.
- Documented the class with a summary explaining its purpose and design.

This change facilitates ORM integration and ensures schema flexibility.
2025-11-25 10:31:55 +01:00
3be1d04a43 Add VwRecAction class to map VWREC_ACTION database view
Introduced the `VwRecAction` class to represent the `VWREC_ACTION`
database view. The class is annotated with `[Table]` and `[Column]`
attributes for schema mapping and includes nullable properties to
handle potential schema changes gracefully. Added `using` directives
for data annotations and schema mapping. Documented the class to
explain its purpose and design decisions, ensuring flexibility and
resilience against database schema evolution.
2025-11-25 10:07:32 +01:00
b6000a56d6 Add ActionController and Swagger support
Updated `ReC.API.csproj` to include `Swashbuckle.AspNetCore` (v6.6.2) for Swagger/OpenAPI documentation. Removed an unused `<ItemGroup>` referencing the `Controllers\` folder.

Added a new `ActionController` with a `[Route("api/[controller]")]` and `[ApiController]` attributes. Introduced a `Trigger` HTTP POST endpoint that accepts a `profileId` parameter. The method is currently unimplemented and throws a `NotImplementedException`.
2025-11-25 00:47:00 +01:00
3f5d3a8c08 Add new ReC.Client project to solution
A new project, ReC.Client, has been added to the solution file (ReC.sln).
The project supports two target frameworks: net462 and net8.0.
Build configurations for Debug and Release have been added, and the
project has been nested under the same parent as other projects.

The ReC.Client.csproj file uses the Microsoft.NET.Sdk SDK and includes
conditional properties for frameworks other than net462, enabling
implicit global usings and nullable reference types.
2025-11-25 00:40:59 +01:00
72e4f53b5d Add ReC.Application project to the solution
A new project, `ReC.Application`, has been added to the solution (`ReC.sln`).
The project file (`ReC.Application.csproj`) targets .NET 8.0, enables implicit
global usings, and enables nullable reference types.

The solution file has been updated to include the new project, its build
configurations, and its nesting under the `src` folder.
2025-11-25 00:36:34 +01:00
f35e29ae49 Add ReC.Infrastructure project to the solution
A new project, `ReC.Infrastructure`, has been added to the solution.
The project is configured to target `.NET 8.0` and includes modern
features such as implicit global usings and nullable reference types.
It has been integrated into the solution's build configurations
(Debug/Release for Any CPU) and nested under the `src` folder.
2025-11-25 00:31:34 +01:00
cb1b02196c Add ReC.Domain project to solution
A new project, `ReC.Domain`, has been added to the solution.
The project is included in `ReC.sln` with build configurations
for `Debug|Any CPU` and `Release|Any CPU`. It is nested under
the `src` folder in the solution structure.

The `ReC.Domain.csproj` file targets .NET 8.0, uses the
`Microsoft.NET.Sdk` SDK, and enables modern C# features such
as implicit `using` directives and nullable reference types.
2025-11-25 00:30:24 +01:00
9de7b89a81 Set up ASP.NET Core Web API project structure
Initialized the ASP.NET Core application in `Program.cs` with
services for controllers, Swagger/OpenAPI, and middleware
for HTTPS redirection and authorization.

Added `launchSettings.json` to configure application launch
profiles for HTTP, HTTPS, and IIS Express environments.

Updated `ReC.API.csproj` to target .NET 8.0, enable nullable
reference types, and include the `Swashbuckle.AspNetCore`
package for Swagger support.

Added `appsettings.json` and `appsettings.Development.json`
for logging and environment-specific configurations.

Reorganized the solution structure in `ReC.sln` by moving
the `ReC.API` project under a `src` folder and updating
the `NestedProjects` section.
2025-11-25 00:28:46 +01:00