Compare commits
24 Commits
fe40cd001f
...
feat/clien
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9628b46ba0 | ||
|
|
1f8142852e | ||
|
|
bdd78be66c | ||
|
|
470902911e | ||
|
|
3f7ebdb632 | ||
|
|
23ef1a5797 | ||
|
|
4a7f2a41fa | ||
|
|
5f9e716ca6 | ||
|
|
91c8b98f44 | ||
|
|
10fc56b262 | ||
|
|
71368e5c85 | ||
|
|
fb649a5c68 | ||
|
|
f4abac1103 | ||
|
|
4c8e9be695 | ||
|
|
b190e4f5e9 | ||
|
|
4a1b221478 | ||
|
|
475acc0a56 | ||
|
|
f8dd16454f | ||
|
|
8cad1df95d | ||
|
|
4ee79d6cd8 | ||
|
|
c0c0650fee | ||
|
|
73059d4554 | ||
|
|
e774afc85e | ||
|
|
1fc4570210 |
5
ReC.sln
5
ReC.sln
@@ -15,6 +15,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReC.Application", "src\ReC.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReC.Client", "src\ReC.Client\ReC.Client.csproj", "{DA3A6BDD-8045-478F-860B-D1F0EB97F02B}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReC.Client", "src\ReC.Client\ReC.Client.csproj", "{DA3A6BDD-8045-478F-860B-D1F0EB97F02B}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
assets\icon.png = assets\icon.png
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|||||||
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
@@ -1,7 +1,6 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using ReC.API.Extensions;
|
using ReC.API.Extensions;
|
||||||
using ReC.Application.OutResults.Commands;
|
|
||||||
using ReC.Application.OutResults.Queries;
|
using ReC.Application.OutResults.Queries;
|
||||||
|
|
||||||
namespace ReC.API.Controllers;
|
namespace ReC.API.Controllers;
|
||||||
@@ -56,34 +55,6 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
|
|||||||
_ => Ok(res),
|
_ => Ok(res),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deletes output results based on the provided criteria.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="command">The command containing the deletion criteria, such as ActionId or ProfileId.</param>
|
|
||||||
/// <param name="cancel">A token to cancel the operation.</param>
|
|
||||||
/// <returns>An empty response indicating success.</returns>
|
|
||||||
[HttpDelete]
|
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
|
||||||
public async Task<IActionResult> Delete([FromQuery] DeleteOutResCommand command, CancellationToken cancel)
|
|
||||||
{
|
|
||||||
await mediator.Send(command, cancel);
|
|
||||||
return NoContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Deletes all output results for a fake/test profile.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cancel">A token to cancel the operation.</param>
|
|
||||||
/// <returns>An empty response indicating success.</returns>
|
|
||||||
[HttpDelete("fake")]
|
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
|
||||||
public async Task<IActionResult> Delete(CancellationToken cancel)
|
|
||||||
{
|
|
||||||
await mediator.Send(new DeleteOutResCommand() { ProfileId = config.GetFakeProfileId() }, cancel);
|
|
||||||
return NoContent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co
|
|||||||
/// <param name="profileId">The ID of the profile.</param>
|
/// <param name="profileId">The ID of the profile.</param>
|
||||||
/// <param name="cancel">A token to cancel the operation.</param>
|
/// <param name="cancel">A token to cancel the operation.</param>
|
||||||
/// <returns>An HTTP 202 Accepted response indicating the process has been started.</returns>
|
/// <returns>An HTTP 202 Accepted response indicating the process has been started.</returns>
|
||||||
[HttpPost("invoke/{profileId}")]
|
[HttpPost("invoke/{cmd}")]
|
||||||
[ProducesResponseType(StatusCodes.Status202Accepted)]
|
[ProducesResponseType(StatusCodes.Status202Accepted)]
|
||||||
public async Task<IActionResult> Invoke([FromRoute] int profileId, CancellationToken cancel)
|
public async Task<IActionResult> Invoke([FromRoute] int profileId, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
@@ -43,7 +43,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all RecActions for a given profile.
|
/// Gets all RecActions for a given profile.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query"></param>
|
/// <param name="profileId">The ID of the profile.</param>
|
||||||
/// <param name="cancel">A token to cancel the operation.</param>
|
/// <param name="cancel">A token to cancel the operation.</param>
|
||||||
/// <returns>A list of RecActions for the specified profile.</returns>
|
/// <returns>A list of RecActions for the specified profile.</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Rewrite;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Web;
|
using NLog.Web;
|
||||||
using ReC.API.Middleware;
|
using ReC.API.Middleware;
|
||||||
using ReC.Application;
|
using ReC.Application;
|
||||||
using ReC.Infrastructure;
|
using ReC.Infrastructure;
|
||||||
using System.Reflection;
|
|
||||||
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
|
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
|
||||||
|
|
||||||
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
||||||
@@ -50,12 +48,7 @@ try
|
|||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen(c =>
|
builder.Services.AddSwaggerGen();
|
||||||
{
|
|
||||||
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
|
||||||
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
|
||||||
c.IncludeXmlComments(xmlPath);
|
|
||||||
});
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
@@ -64,13 +57,10 @@ try
|
|||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment() || config.GetValue<bool>("UseSwagger"))
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
|
|
||||||
var rewriteOptions = new RewriteOptions().AddRedirect("^$", "swagger");
|
|
||||||
app.UseRewriter(rewriteOptions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|||||||
@@ -10,13 +10,11 @@
|
|||||||
<Product>ReC.API</Product>
|
<Product>ReC.API</Product>
|
||||||
<PackageIcon>Assets\icon.ico</PackageIcon>
|
<PackageIcon>Assets\icon.ico</PackageIcon>
|
||||||
<PackageTags>digital data rest-caller rec api</PackageTags>
|
<PackageTags>digital data rest-caller rec api</PackageTags>
|
||||||
<Version>1.0.2-beta</Version>
|
<Version>1.0.0-beta</Version>
|
||||||
<AssemblyVersion>1.0.2.0</AssemblyVersion>
|
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||||
<FileVersion>1.0.2.0</FileVersion>
|
<FileVersion>1.0.0.0</FileVersion>
|
||||||
<InformationalVersion>1.0.0-beta</InformationalVersion>
|
<InformationalVersion>1.0.0-beta</InformationalVersion>
|
||||||
<Copyright>Copyright © 2025 Digital Data GmbH. All rights reserved.</Copyright>
|
<Copyright>Copyright © 2025 Digital Data GmbH. All rights reserved.</Copyright>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"UseSwagger": true,
|
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"Default": "Server=SDD-VMP04-SQL19\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
"Default": "Server=SDD-VMP04-SQL19\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
using DigitalData.Core.Abstraction.Application.Repository;
|
|
||||||
using MediatR;
|
|
||||||
using ReC.Domain.Entities;
|
|
||||||
|
|
||||||
namespace ReC.Application.OutResults.Commands;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the command to delete output results based on specified criteria.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Deletion can be performed by providing either an <see cref="ActionId"/> or a <see cref="ProfileId"/>.
|
|
||||||
/// At least one of these properties must be set for the operation to proceed.
|
|
||||||
/// </remarks>
|
|
||||||
public record DeleteOutResCommand : IRequest
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the unique identifier for the action whose output results should be deleted.
|
|
||||||
/// </summary>
|
|
||||||
public long? ActionId { get; init; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the unique identifier for the profile whose associated action's output results should be deleted.
|
|
||||||
/// </summary>
|
|
||||||
public long? ProfileId { get; init; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handles the execution of the <see cref="DeleteOutResCommand"/>.
|
|
||||||
/// </summary>
|
|
||||||
public class DeleteOutResCommandHandler(IRepository<OutRes> repo) : IRequestHandler<DeleteOutResCommand>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Processes the delete command by removing matching <see cref="OutRes"/> entities from the repository.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request">The command containing the deletion criteria.</param>
|
|
||||||
/// <param name="cancel">A cancellation token that can be used to cancel the work.</param>
|
|
||||||
/// <returns>A task that represents the asynchronous delete operation.</returns>
|
|
||||||
/// <remarks>
|
|
||||||
/// The handler deletes records where <c>OutRes.ActionId</c> matches <see cref="DeleteOutResCommand.ActionId"/>
|
|
||||||
/// or where the associated <c>Action.ProfileId</c> matches <see cref="DeleteOutResCommand.ProfileId"/>.
|
|
||||||
/// </remarks>
|
|
||||||
public Task Handle(DeleteOutResCommand request, CancellationToken cancel)
|
|
||||||
{
|
|
||||||
return repo.DeleteAsync(x => x.ActionId == request.ActionId || x.Action!.ProfileId == request.ProfileId, cancel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using FluentValidation;
|
|
||||||
|
|
||||||
namespace ReC.Application.OutResults.Commands;
|
|
||||||
|
|
||||||
public class DeleteOutResCommandValidator : AbstractValidator<DeleteOutResCommand>
|
|
||||||
{
|
|
||||||
public DeleteOutResCommandValidator()
|
|
||||||
{
|
|
||||||
RuleFor(x => x)
|
|
||||||
.Must(x => x.ActionId.HasValue || x.ProfileId.HasValue)
|
|
||||||
.WithMessage("At least one of ActionId or ProfileId must be provided.")
|
|
||||||
.WithName("Identifier");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using ReC.Application.RecActions.Queries;
|
using ReC.Application.RecActions.Queries;
|
||||||
|
|
||||||
namespace ReC.Application.RecActions.Commands;
|
namespace ReC.Application.RecActions.Commands;
|
||||||
@@ -11,13 +13,40 @@ public static class InvokeBatchRecActionsCommandExtensions
|
|||||||
=> sender.Send(new InvokeBatchRecActionsCommand { ProfileId = profileId }, cancel);
|
=> sender.Send(new InvokeBatchRecActionsCommand { ProfileId = profileId }, cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InvokeRecActionsCommandHandler(ISender sender) : IRequestHandler<InvokeBatchRecActionsCommand>
|
public class InvokeRecActionsCommandHandler(ISender sender, IServiceScopeFactory scopeFactory, IHttpClientFactory clientFactory, ILogger<InvokeRecActionsCommandHandler>? logger = null) : IRequestHandler<InvokeBatchRecActionsCommand>
|
||||||
{
|
{
|
||||||
public async Task Handle(InvokeBatchRecActionsCommand request, CancellationToken cancel)
|
public async Task Handle(InvokeBatchRecActionsCommand request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
var actions = await sender.Send(request.ToReadQuery(q => q.Invoked = false), cancel);
|
var actions = await sender.Send(request.ToReadQuery(q => q.Invoked = false), cancel);
|
||||||
|
|
||||||
foreach (var action in actions)
|
var http = clientFactory.CreateClient();
|
||||||
|
|
||||||
|
using var semaphore = new SemaphoreSlim(5);
|
||||||
|
|
||||||
|
var tasks = actions.Select(async action =>
|
||||||
|
{
|
||||||
|
await semaphore.WaitAsync(cancel);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var scope = scopeFactory.CreateScope();
|
||||||
|
var sender = scope.ServiceProvider.GetRequiredService<ISender>();
|
||||||
await sender.Send(action.ToInvokeCommand(), cancel);
|
await sender.Send(action.ToInvokeCommand(), cancel);
|
||||||
}
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
logger?.LogError(
|
||||||
|
ex,
|
||||||
|
"Error invoking Rec action. ProfileId: {ProfileId}, Id: {Id}",
|
||||||
|
action.ProfileId,
|
||||||
|
action.Id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
semaphore.Release();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await Task.WhenAll(tasks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
41
src/ReC.Client/DependencyInjection.cs
Normal file
41
src/ReC.Client/DependencyInjection.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
#if NETFRAMEWORK
|
||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace ReC.Client
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides extension methods for setting up the ReC client in an <see cref="IServiceCollection"/>.
|
||||||
|
/// </summary>
|
||||||
|
public static class DependencyInjection
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds and configures the <see cref="HttpClient"/> for the <see cref="ReCClient"/> to the specified <see cref="IServiceCollection"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
|
||||||
|
/// <param name="apiUri">The base URI of the ReC API.</param>
|
||||||
|
/// <returns>An <see cref="IHttpClientBuilder"/> that can be used to configure the client.</returns>
|
||||||
|
public static IHttpClientBuilder AddRecClient(this IServiceCollection services, string apiUri)
|
||||||
|
{
|
||||||
|
services.AddScoped<ReCClient>();
|
||||||
|
return services.AddHttpClient(ReCClient.ClientName, client =>
|
||||||
|
{
|
||||||
|
client.BaseAddress = new Uri(apiUri);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds and configures the <see cref="HttpClient"/> for the <see cref="ReCClient"/> to the specified <see cref="IServiceCollection"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
|
||||||
|
/// <param name="configureClient">An action to configure the <see cref="HttpClient"/>.</param>
|
||||||
|
/// <returns>An <see cref="IHttpClientBuilder"/> that can be used to configure the client.</returns>
|
||||||
|
public static IHttpClientBuilder AddRecClient(this IServiceCollection services, Action<HttpClient> configureClient)
|
||||||
|
{
|
||||||
|
services.AddScoped<ReCClient>();
|
||||||
|
return services.AddHttpClient(ReCClient.ClientName, configureClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,36 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net462;net8.0</TargetFrameworks>
|
<TargetFrameworks>net462;net8.0</TargetFrameworks>
|
||||||
|
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(MSBuildProjectName).xml</DocumentationFile>
|
||||||
|
<PackageId>ReC.Client</PackageId>
|
||||||
|
<Authors>Digital Data GmbH</Authors>
|
||||||
|
<Company>Digital Data GmbH</Company>
|
||||||
|
<Product>ReC.Client</Product>
|
||||||
|
<Copyright>Copyright 2025</Copyright>
|
||||||
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
|
<RepositoryUrl>http://git.dd:3000/AppStd/Rec.git</RepositoryUrl>
|
||||||
|
<PackageTags>digital data rec api</PackageTags>
|
||||||
|
<Version>1.0.0-beta</Version>
|
||||||
|
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||||
|
<FileVersion>1.0.0.0</FileVersion>
|
||||||
|
<Description>Client-Bibliothek für die Interaktion mit der ReC.API, die typisierten HTTP-Zugriff und DI-Integration bietet.</Description>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(TargetFramework)' != 'net462'">
|
<PropertyGroup Condition="'$(TargetFramework)' != 'net462'">
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\assets\icon.png">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath>\</PackagePath>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||||
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
124
src/ReC.Client/ReCClient.cs
Normal file
124
src/ReC.Client/ReCClient.cs
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
#if NETFRAMEWORK
|
||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace ReC.Client
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A client for interacting with the ReC API.
|
||||||
|
/// </summary>
|
||||||
|
public class ReCClient
|
||||||
|
{
|
||||||
|
private readonly HttpClient _http;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A unique name for the HttpClient used by the ReCClient.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string ClientName = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ReCClient"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="httpClientFactory">The factory to create HttpClients.</param>
|
||||||
|
public ReCClient(IHttpClientFactory httpClientFactory)
|
||||||
|
{
|
||||||
|
_http = httpClientFactory.CreateClient(ClientName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Asynchronously invokes a ReC action for a specific profile.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method sends a POST request to the <c>api/RecAction/invoke/{profileId}</c> endpoint.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="profileId">The ID of the profile to invoke the action for.</param>
|
||||||
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
||||||
|
/// <returns>A <see cref="Task{TResult}"/> that represents the asynchronous operation. The task result is <see langword="true"/> if the request was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
|
public async Task<bool> InvokeRecActionAsync(int profileId, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
var resp = await _http.PostAsync($"api/RecAction/invoke/{profileId}", content: null, cancellationToken);
|
||||||
|
return resp.IsSuccessStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Synchronously invokes a ReC action for a specific profile.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method sends a POST request to the <c>api/RecAction/invoke/{profileId}</c> endpoint.
|
||||||
|
/// This is the synchronous version of <see cref="InvokeRecActionAsync(int, CancellationToken)"/>.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="profileId">The ID of the profile to invoke the action for.</param>
|
||||||
|
/// <returns><see langword="true"/> if the request was successful; otherwise, <see langword="false"/>.</returns>
|
||||||
|
[Obsolete("Use InvokeRecActionAsync instead to avoid potential deadlocks and improve performance.")]
|
||||||
|
public bool InvokeRecAction(int profileId)
|
||||||
|
{
|
||||||
|
var resp = _http.PostAsync($"api/RecAction/invoke/{profileId}", content: null).GetAwaiter().GetResult();
|
||||||
|
return resp.IsSuccessStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Static
|
||||||
|
private static readonly IServiceCollection Services = new ServiceCollection();
|
||||||
|
|
||||||
|
#if NET8_0_OR_GREATER
|
||||||
|
private static IServiceProvider? Provider = null;
|
||||||
|
#else
|
||||||
|
private static IServiceProvider Provider = null;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Configures and builds the static <see cref="IServiceProvider"/> for creating <see cref="ReCClient"/> instances.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method should only be called once during application startup.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="apiUri">The base URI of the ReC API.</param>
|
||||||
|
/// <exception cref="InvalidOperationException">Thrown if the static provider has already been built.</exception>
|
||||||
|
[Obsolete("Use a local service collection instead of the static provider.")]
|
||||||
|
public static void BuildStaticClient(string apiUri)
|
||||||
|
{
|
||||||
|
if(Provider != null)
|
||||||
|
throw new InvalidOperationException("Static Provider is already built.");
|
||||||
|
|
||||||
|
Services.AddRecClient(apiUri);
|
||||||
|
Provider = Services.BuildServiceProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Configures and builds the static <see cref="IServiceProvider"/> for creating <see cref="ReCClient"/> instances.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method should only be called once during application startup.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="configureClient">An action to configure the <see cref="HttpClient"/>.</param>
|
||||||
|
/// <exception cref="InvalidOperationException">Thrown if the static provider has already been built.</exception>
|
||||||
|
[Obsolete("Use a local service collection instead of the static provider.")]
|
||||||
|
public static void BuildStaticClient(Action<HttpClient> configureClient)
|
||||||
|
{
|
||||||
|
if (Provider != null)
|
||||||
|
throw new InvalidOperationException("Static Provider is already built.");
|
||||||
|
|
||||||
|
Services.AddRecClient(configureClient);
|
||||||
|
Provider = Services.BuildServiceProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="ReCClient"/> instance using the statically configured provider.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A new instance of the <see cref="ReCClient"/>.</returns>
|
||||||
|
/// <exception cref="InvalidOperationException">Thrown if <see cref="BuildStaticClient(string)"/> has not been called yet.</exception>
|
||||||
|
[Obsolete("Use a local service collection instead of the static provider.")]
|
||||||
|
public static ReCClient Create()
|
||||||
|
{
|
||||||
|
if (Provider == null)
|
||||||
|
throw new InvalidOperationException("Static Provider is not built. Call BuildStaticClient first.");
|
||||||
|
|
||||||
|
return Provider.GetRequiredService<ReCClient>();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace ReC.Domain.Attributes;
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Property)]
|
|
||||||
public class MustConfiguredAttribute : Attribute
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
namespace ReC.Domain.Entities;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
public class BodyQueryResult
|
public class BodyQueryResult
|
||||||
{
|
{
|
||||||
|
[Column("REQUEST_BODY")]
|
||||||
public string? RawBody { get; init; }
|
public string? RawBody { get; init; }
|
||||||
}
|
}
|
||||||
@@ -1,32 +1,52 @@
|
|||||||
namespace ReC.Domain.Entities;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
|
[Table("TBDD_CONNECTION")]
|
||||||
public class Connection
|
public class Connection
|
||||||
{
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Column("GUID")]
|
||||||
public short? Id { get; set; }
|
public short? Id { get; set; }
|
||||||
|
|
||||||
|
[Column("BEZEICHNUNG")]
|
||||||
public string? Bezeichnung { get; set; }
|
public string? Bezeichnung { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_PROVIDER")]
|
||||||
public string? SqlProvider { get; set; }
|
public string? SqlProvider { get; set; }
|
||||||
|
|
||||||
|
[Column("SERVER")]
|
||||||
public string? Server { get; set; }
|
public string? Server { get; set; }
|
||||||
|
|
||||||
|
[Column("DATENBANK")]
|
||||||
public string? Datenbank { get; set; }
|
public string? Datenbank { get; set; }
|
||||||
|
|
||||||
|
[Column("USERNAME")]
|
||||||
public string? Username { get; set; }
|
public string? Username { get; set; }
|
||||||
|
|
||||||
|
[Column("PASSWORD")]
|
||||||
public string? Password { get; set; }
|
public string? Password { get; set; }
|
||||||
|
|
||||||
|
[Column("BEMERKUNG")]
|
||||||
public string? Bemerkung { get; set; }
|
public string? Bemerkung { get; set; }
|
||||||
|
|
||||||
|
[Column("AKTIV")]
|
||||||
public bool? Aktiv { get; set; }
|
public bool? Aktiv { get; set; }
|
||||||
|
|
||||||
|
[Column("ERSTELLTWER")]
|
||||||
public string? ErstelltWer { get; set; }
|
public string? ErstelltWer { get; set; }
|
||||||
|
|
||||||
|
[Column("ERSTELLTWANN")]
|
||||||
public DateTime? ErstelltWann { get; set; }
|
public DateTime? ErstelltWann { get; set; }
|
||||||
|
|
||||||
|
[Column("GEANDERTWER")]
|
||||||
public string? GeandertWer { get; set; }
|
public string? GeandertWer { get; set; }
|
||||||
|
|
||||||
|
[Column("GEAENDERTWANN")]
|
||||||
public DateTime? GeaendertWann { get; set; }
|
public DateTime? GeaendertWann { get; set; }
|
||||||
|
|
||||||
|
[Column("SYS_CONNECTION")]
|
||||||
public bool? SysConnection { get; set; }
|
public bool? SysConnection { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,34 @@
|
|||||||
namespace ReC.Domain.Entities;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
|
[Table("TBREC_CFG_ENDPOINT")]
|
||||||
public class Endpoint
|
public class Endpoint
|
||||||
{
|
{
|
||||||
|
[Key]
|
||||||
|
[Column("GUID")]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
[Column("ACTIVE")]
|
||||||
public bool? Active { get; set; }
|
public bool? Active { get; set; }
|
||||||
|
|
||||||
|
[Column("DESCRIPTION")]
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
[Column("URI")]
|
||||||
public string? Uri { get; set; }
|
public string? Uri { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHO")]
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHEN")]
|
||||||
public DateTime? AddedWhen { get; set; }
|
public DateTime? AddedWhen { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHO")]
|
||||||
public string? ChangedWho { get; set; }
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHEN")]
|
||||||
public DateTime? ChangedWhen { get; set; }
|
public DateTime? ChangedWhen { get; set; }
|
||||||
}
|
}
|
||||||
@@ -3,37 +3,56 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace ReC.Domain.Entities;
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
|
[Table("TBREC_CFG_ENDPOINT_AUTH")]
|
||||||
public class EndpointAuth
|
public class EndpointAuth
|
||||||
{
|
{
|
||||||
|
[Key]
|
||||||
|
[Column("GUID")]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
[Column("ACTIVE")]
|
||||||
public bool? Active { get; set; }
|
public bool? Active { get; set; }
|
||||||
|
|
||||||
|
[Column("DESCRIPTION")]
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
[Column("TYPE")]
|
||||||
public string? Type { get; set; }
|
public string? Type { get; set; }
|
||||||
|
|
||||||
|
[Column("API_KEY")]
|
||||||
public string? ApiKey { get; set; }
|
public string? ApiKey { get; set; }
|
||||||
|
|
||||||
|
[Column("API_VALUE")]
|
||||||
public string? ApiValue { get; set; }
|
public string? ApiValue { get; set; }
|
||||||
|
|
||||||
|
[Column("API_KEY_ADD_TO")]
|
||||||
public string? ApiKeyAddTo { get; set; }
|
public string? ApiKeyAddTo { get; set; }
|
||||||
|
|
||||||
|
[Column("TOKEN")]
|
||||||
public string? Token { get; set; }
|
public string? Token { get; set; }
|
||||||
|
|
||||||
|
[Column("USERNAME")]
|
||||||
public string? Username { get; set; }
|
public string? Username { get; set; }
|
||||||
|
|
||||||
|
[Column("PASSWORD")]
|
||||||
public string? Password { get; set; }
|
public string? Password { get; set; }
|
||||||
|
|
||||||
|
[Column("DOMAIN")]
|
||||||
public string? Domain { get; set; }
|
public string? Domain { get; set; }
|
||||||
|
|
||||||
|
[Column("WORKSTATION")]
|
||||||
public string? Workstation { get; set; }
|
public string? Workstation { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHO")]
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHEN")]
|
||||||
public DateTime? AddedWhen { get; set; }
|
public DateTime? AddedWhen { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHO")]
|
||||||
public string? ChangedWho { get; set; }
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHEN")]
|
||||||
public DateTime? ChangedWhen { get; set; }
|
public DateTime? ChangedWhen { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,47 @@
|
|||||||
namespace ReC.Domain.Entities;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the TBREC_CFG_ENDPOINT_PARAMS table.
|
/// Represents the TBREC_CFG_ENDPOINT_PARAMS table.
|
||||||
/// All properties are nullable to provide flexibility on the database side,
|
/// All properties are nullable to provide flexibility on the database side,
|
||||||
/// preventing breaking changes if columns are altered to be nullable in production.
|
/// preventing breaking changes if columns are altered to be nullable in production.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Table("TBREC_CFG_ENDPOINT_PARAMS", Schema = "dbo")]
|
||||||
public class EndpointParam
|
public class EndpointParam
|
||||||
{
|
{
|
||||||
|
[Key]
|
||||||
|
[Column("GUID")]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
[Column("ACTIVE")]
|
||||||
public bool? Active { get; set; }
|
public bool? Active { get; set; }
|
||||||
|
|
||||||
|
[Column("DESCRIPTION")]
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
[Column("GROUP_ID")]
|
||||||
public short? GroupId { get; set; }
|
public short? GroupId { get; set; }
|
||||||
|
|
||||||
|
[Column("SEQUENCE")]
|
||||||
public byte? Sequence { get; set; }
|
public byte? Sequence { get; set; }
|
||||||
|
|
||||||
|
[Column("KEY")]
|
||||||
public string? Key { get; set; }
|
public string? Key { get; set; }
|
||||||
|
|
||||||
|
[Column("VALUE")]
|
||||||
public string? Value { get; set; }
|
public string? Value { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHO")]
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHEN")]
|
||||||
public DateTime? AddedWhen { get; set; }
|
public DateTime? AddedWhen { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHO")]
|
||||||
public string? ChangedWho { get; set; }
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHEN")]
|
||||||
public DateTime? ChangedWhen { get; set; }
|
public DateTime? ChangedWhen { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
namespace ReC.Domain.Entities;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
public class HeaderQueryResult
|
public class HeaderQueryResult
|
||||||
{
|
{
|
||||||
|
[Column("REQUEST_HEADER")]
|
||||||
public string? RawHeader { get; init; }
|
public string? RawHeader { get; init; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,37 @@
|
|||||||
namespace ReC.Domain.Entities;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
|
[Table("TBREC_OUT_RESULT", Schema = "dbo")]
|
||||||
public class OutRes
|
public class OutRes
|
||||||
{
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Column("GUID")]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
[Column("ACTION_ID")]
|
||||||
public long? ActionId { get; set; }
|
public long? ActionId { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("ActionId")]
|
||||||
public RecAction? Action { get; set; }
|
public RecAction? Action { get; set; }
|
||||||
|
|
||||||
|
[Column("RESULT_HEADER")]
|
||||||
public string? Header { get; set; }
|
public string? Header { get; set; }
|
||||||
|
|
||||||
|
[Column("RESULT_BODY")]
|
||||||
public string? Body { get; set; }
|
public string? Body { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHO")]
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHEN")]
|
||||||
public DateTime? AddedWhen { get; set; }
|
public DateTime? AddedWhen { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHO")]
|
||||||
public string? ChangedWho { get; set; }
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHEN")]
|
||||||
public DateTime? ChangedWhen { get; set; }
|
public DateTime? ChangedWhen { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,46 @@
|
|||||||
namespace ReC.Domain.Entities;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
|
[Table("TBREC_CFG_PROFILE", Schema = "dbo")]
|
||||||
public class Profile
|
public class Profile
|
||||||
{
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Column("GUID")]
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
[Column("ACTIVE")]
|
||||||
public bool? Active { get; set; }
|
public bool? Active { get; set; }
|
||||||
|
|
||||||
|
[Column("TYPE")]
|
||||||
public string? Type { get; set; }
|
public string? Type { get; set; }
|
||||||
|
|
||||||
|
[Column("MANDANTOR")]
|
||||||
public string? Mandantor { get; set; }
|
public string? Mandantor { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_NAME")]
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
[Column("DESCRIPTION")]
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
[Column("LOG_LEVEL")]
|
||||||
public string? LogLevel { get; set; }
|
public string? LogLevel { get; set; }
|
||||||
|
|
||||||
|
[Column("LANGUAGE")]
|
||||||
public string? Language { get; set; }
|
public string? Language { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHO")]
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHEN")]
|
||||||
public DateTime? AddedWhen { get; set; }
|
public DateTime? AddedWhen { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHO")]
|
||||||
public string? ChangedWho { get; set; }
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHEN")]
|
||||||
public DateTime? ChangedWhen { get; set; }
|
public DateTime? ChangedWhen { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,47 +1,73 @@
|
|||||||
namespace ReC.Domain.Entities;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
|
[Table("TBREC_CFG_ACTION")]
|
||||||
public class RecAction
|
public class RecAction
|
||||||
{
|
{
|
||||||
|
[Key]
|
||||||
|
[Column("GUID")]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_ID")]
|
||||||
public long? ProfileId { get; set; }
|
public long? ProfileId { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("ProfileId")]
|
||||||
public Profile? Profile { get; set; }
|
public Profile? Profile { get; set; }
|
||||||
|
|
||||||
|
[Column("ACTIVE")]
|
||||||
public bool? Active { get; set; }
|
public bool? Active { get; set; }
|
||||||
|
|
||||||
|
[Column("SEQUENCE")]
|
||||||
public byte? Sequence { get; set; }
|
public byte? Sequence { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_ID")]
|
||||||
public long? EndpointId { get; set; }
|
public long? EndpointId { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("EndpointId")]
|
||||||
public Endpoint? Endpoint { get; set; }
|
public Endpoint? Endpoint { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_ID")]
|
||||||
public long? EndpointAuthId { get; set; }
|
public long? EndpointAuthId { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("EndpointAuthId")]
|
||||||
public EndpointAuth? EndpointAuth { get; set; }
|
public EndpointAuth? EndpointAuth { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_PARAMS_ID")]
|
||||||
public short? EndpointParamsId { get; set; }
|
public short? EndpointParamsId { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_ID")]
|
||||||
public short? SqlConnectionId { get; set; }
|
public short? SqlConnectionId { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("SqlConnectionId")]
|
||||||
public Connection? SqlConnection { get; set; }
|
public Connection? SqlConnection { get; set; }
|
||||||
|
|
||||||
|
[Column("TYPE")]
|
||||||
public string? Type { get; set; }
|
public string? Type { get; set; }
|
||||||
|
|
||||||
|
[Column("PREPROCESSING_QUERY")]
|
||||||
public string? PreprocessingQuery { get; set; }
|
public string? PreprocessingQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("HEADER_QUERY")]
|
||||||
public string? HeaderQuery { get; set; }
|
public string? HeaderQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("BODY_QUERY")]
|
||||||
public string? BodyQuery { get; set; }
|
public string? BodyQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("POSTPROCESSING_QUERY")]
|
||||||
public string? PostprocessingQuery { get; set; }
|
public string? PostprocessingQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHO")]
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHEN")]
|
||||||
public DateTime? AddedWhen { get; set; }
|
public DateTime? AddedWhen { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHO")]
|
||||||
public string? ChangedWho { get; set; }
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("CHANGED_WHEN")]
|
||||||
public DateTime? ChangedWhen { get; set; }
|
public DateTime? ChangedWhen { get; set; }
|
||||||
|
|
||||||
public OutRes? OutRes { get; set; }
|
public OutRes? OutRes { get; set; }
|
||||||
|
|||||||
@@ -11,65 +11,113 @@ namespace ReC.Domain.Entities;
|
|||||||
/// runtime mapping errors and ensures the application can handle schema changes without
|
/// runtime mapping errors and ensures the application can handle schema changes without
|
||||||
/// requiring immediate code updates.
|
/// requiring immediate code updates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Table("VWREC_ACTION", Schema = "dbo")]
|
||||||
public class RecActionView
|
public class RecActionView
|
||||||
{
|
{
|
||||||
|
[Column("ACTION_ID")]
|
||||||
public required long Id { get; set; }
|
public required long Id { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("Id")]
|
||||||
public RecAction? Root { get; set; }
|
public RecAction? Root { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_ID")]
|
||||||
public long? ProfileId { get; set; }
|
public long? ProfileId { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("ProfileId")]
|
||||||
public Profile? Profile { get; set; }
|
public Profile? Profile { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_NAME")]
|
||||||
|
[MaxLength(100)]
|
||||||
public string? ProfileName { get; set; }
|
public string? ProfileName { get; set; }
|
||||||
|
|
||||||
|
[Column("PROFILE_TYPE")]
|
||||||
|
[MaxLength(20)]
|
||||||
public string? ProfileType { get; set; }
|
public string? ProfileType { get; set; }
|
||||||
|
|
||||||
public byte? Sequence { get; set; }
|
[Column("PROFILE_SEQUENCE")]
|
||||||
|
public byte? ProfileSequence { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_ID")]
|
||||||
public long? EndpointId { get; set; }
|
public long? EndpointId { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_URI")]
|
||||||
|
[MaxLength(4000)]
|
||||||
public string? EndpointUri { get; set; }
|
public string? EndpointUri { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_ID")]
|
||||||
public long? EndpointAuthId { get; set; }
|
public long? EndpointAuthId { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_TYPE")]
|
||||||
|
[MaxLength(50)]
|
||||||
public string? EndpointAuthType { get; set; }
|
public string? EndpointAuthType { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_API_KEY")]
|
||||||
|
[MaxLength(300)]
|
||||||
public string? EndpointAuthApiKey { get; set; }
|
public string? EndpointAuthApiKey { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_API_VALUE")]
|
||||||
|
[MaxLength(300)]
|
||||||
public string? EndpointAuthApiValue { get; set; }
|
public string? EndpointAuthApiValue { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_API_KEY_ADD_TO")]
|
||||||
|
[MaxLength(20)]
|
||||||
public string? EndpointAuthApiKeyAddTo { get; set; }
|
public string? EndpointAuthApiKeyAddTo { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_TOKEN")]
|
||||||
|
[MaxLength(300)]
|
||||||
public string? EndpointAuthToken { get; set; }
|
public string? EndpointAuthToken { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_USERNAME")]
|
||||||
|
[MaxLength(200)]
|
||||||
public string? EndpointAuthUsername { get; set; }
|
public string? EndpointAuthUsername { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_PASSWORD")]
|
||||||
|
[MaxLength(200)]
|
||||||
public string? EndpointAuthPassword { get; set; }
|
public string? EndpointAuthPassword { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_DOMAIN")]
|
||||||
|
[MaxLength(100)]
|
||||||
public string? EndpointAuthDomain { get; set; }
|
public string? EndpointAuthDomain { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_AUTH_WORKSTATION")]
|
||||||
|
[MaxLength(100)]
|
||||||
public string? EndpointAuthWorkstation { get; set; }
|
public string? EndpointAuthWorkstation { get; set; }
|
||||||
|
|
||||||
|
[Column("ENDPOINT_PARAMS_ID")]
|
||||||
public short? EndpointParamsId { get; set; }
|
public short? EndpointParamsId { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_ID")]
|
||||||
public short? SqlConnectionId { get; set; }
|
public short? SqlConnectionId { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_SERVER")]
|
||||||
|
[MaxLength(150)]
|
||||||
public string? SqlConnectionServer { get; set; }
|
public string? SqlConnectionServer { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_DB")]
|
||||||
|
[MaxLength(100)]
|
||||||
public string? SqlConnectionDb { get; set; }
|
public string? SqlConnectionDb { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_USERNAME")]
|
||||||
|
[MaxLength(100)]
|
||||||
public string? SqlConnectionUsername { get; set; }
|
public string? SqlConnectionUsername { get; set; }
|
||||||
|
|
||||||
|
[Column("SQL_CONNECTION_PASSWORD")]
|
||||||
|
[MaxLength(100)]
|
||||||
public string? SqlConnectionPassword { get; set; }
|
public string? SqlConnectionPassword { get; set; }
|
||||||
|
|
||||||
|
[Column("REST_TYPE")]
|
||||||
|
[MaxLength(20)]
|
||||||
public string? RestType { get; set; }
|
public string? RestType { get; set; }
|
||||||
|
|
||||||
|
[Column("PREPROCESSING_QUERY")]
|
||||||
public string? PreprocessingQuery { get; set; }
|
public string? PreprocessingQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("HEADER_QUERY")]
|
||||||
public string? HeaderQuery { get; set; }
|
public string? HeaderQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("BODY_QUERY")]
|
||||||
public string? BodyQuery { get; set; }
|
public string? BodyQuery { get; set; }
|
||||||
|
|
||||||
|
[Column("POSTPROCESSING_QUERY")]
|
||||||
public string? PostprocessingQuery { get; set; }
|
public string? PostprocessingQuery { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
namespace ReC.Infrastructure.Exceptions;
|
|
||||||
|
|
||||||
public class DbModelConfigurationException : Exception
|
|
||||||
{
|
|
||||||
public DbModelConfigurationException(string message) : base(message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public DbModelConfigurationException()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using ReC.Infrastructure.Exceptions;
|
|
||||||
using ReC.Infrastructure.Options.Shared;
|
|
||||||
|
|
||||||
namespace ReC.Infrastructure.Options;
|
|
||||||
|
|
||||||
public record DbModelOptions
|
|
||||||
{
|
|
||||||
public Dictionary<string, EntityOptions> Entities { get; init; } = [];
|
|
||||||
|
|
||||||
public Dictionary<string, VirtualEntityOptions> VirtualEntities { get; init; } = [];
|
|
||||||
|
|
||||||
public void EnsureEntity<T>(bool isVirtual)
|
|
||||||
{
|
|
||||||
var entities = isVirtual
|
|
||||||
? VirtualEntities.ToDictionary(kvp => kvp.Key, kvp => kvp.Value as EntityBaseOptions)
|
|
||||||
: Entities.ToDictionary(kvp => kvp.Key, kvp => kvp.Value as EntityBaseOptions);
|
|
||||||
|
|
||||||
if(entities.TryGetValue(nameof(T), out var entityOptions))
|
|
||||||
entityOptions.EnsureProperties<T>();
|
|
||||||
else
|
|
||||||
throw new DbModelConfigurationException($"Entity options for type '{typeof(T).FullName}' not found.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
using ReC.Domain.Attributes;
|
|
||||||
using ReC.Infrastructure.Exceptions;
|
|
||||||
|
|
||||||
namespace ReC.Infrastructure.Options.Shared;
|
|
||||||
|
|
||||||
public record EntityBaseOptions()
|
|
||||||
{
|
|
||||||
public Dictionary<string, string> ColumnMappings { get; init; } = [];
|
|
||||||
|
|
||||||
public IEnumerable<string> PropertyNames => ColumnMappings.Select(col => col.Key);
|
|
||||||
|
|
||||||
public IEnumerable<string> ColumnNames => ColumnMappings.Select(col => col.Value);
|
|
||||||
|
|
||||||
public void EnsureProperties(IEnumerable<string> propertyNames)
|
|
||||||
{
|
|
||||||
var missingProperties = propertyNames.Except(PropertyNames).ToList();
|
|
||||||
|
|
||||||
if (missingProperties.Count != 0)
|
|
||||||
throw new DbModelConfigurationException($"The following properties are not configured: {string.Join(", ", missingProperties)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EnsureProperties(params string[] propertyNames)
|
|
||||||
=> EnsureProperties(propertyNames.AsEnumerable());
|
|
||||||
|
|
||||||
public void EnsureProperties<T>()
|
|
||||||
{
|
|
||||||
var propertyNames = typeof(T)
|
|
||||||
.GetProperties()
|
|
||||||
.Where(prop => Attribute.IsDefined(prop, typeof(MustConfiguredAttribute)))
|
|
||||||
.Select(prop => prop.Name);
|
|
||||||
EnsureProperties(propertyNames);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
namespace ReC.Infrastructure.Options.Shared;
|
|
||||||
|
|
||||||
public record EntityOptions(TableOptions Table) : EntityBaseOptions;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
namespace ReC.Infrastructure.Options.Shared;
|
|
||||||
|
|
||||||
public record TableOptions(string Name, string? Schema = null);
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
namespace ReC.Infrastructure.Options.Shared;
|
|
||||||
|
|
||||||
public record VirtualEntityOptions : EntityBaseOptions;
|
|
||||||
@@ -30,214 +30,15 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
|
|||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity<Connection>(b =>
|
modelBuilder.Entity<RecActionView>().HasNoKey();
|
||||||
{
|
|
||||||
b.ToTable("TBDD_CONNECTION");
|
|
||||||
|
|
||||||
b.HasKey(e => e.Id);
|
modelBuilder.Entity<HeaderQueryResult>().HasNoKey();
|
||||||
|
|
||||||
b.Property(e => e.Id)
|
modelBuilder.Entity<BodyQueryResult>().HasNoKey();
|
||||||
.HasColumnName("GUID")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property(e => e.Bezeichnung).HasColumnName("BEZEICHNUNG");
|
modelBuilder.Entity<RecAction>()
|
||||||
b.Property(e => e.SqlProvider).HasColumnName("SQL_PROVIDER");
|
.HasOne(act => act.OutRes)
|
||||||
b.Property(e => e.Server).HasColumnName("SERVER");
|
|
||||||
b.Property(e => e.Datenbank).HasColumnName("DATENBANK");
|
|
||||||
b.Property(e => e.Username).HasColumnName("USERNAME");
|
|
||||||
b.Property(e => e.Password).HasColumnName("PASSWORD");
|
|
||||||
b.Property(e => e.Bemerkung).HasColumnName("BEMERKUNG");
|
|
||||||
b.Property(e => e.Aktiv).HasColumnName("AKTIV");
|
|
||||||
b.Property(e => e.ErstelltWer).HasColumnName("ERSTELLTWER");
|
|
||||||
b.Property(e => e.ErstelltWann).HasColumnName("ERSTELLTWANN");
|
|
||||||
b.Property(e => e.GeandertWer).HasColumnName("GEANDERTWER");
|
|
||||||
b.Property(e => e.GeaendertWann).HasColumnName("GEAENDERTWANN");
|
|
||||||
b.Property(e => e.SysConnection).HasColumnName("SYS_CONNECTION");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<Endpoint>(b =>
|
|
||||||
{
|
|
||||||
b.ToTable("TBREC_CFG_ENDPOINT");
|
|
||||||
|
|
||||||
b.HasKey(e => e.Id);
|
|
||||||
|
|
||||||
b.Property(e => e.Id)
|
|
||||||
.HasColumnName("GUID")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property(e => e.Active).HasColumnName("ACTIVE");
|
|
||||||
b.Property(e => e.Description).HasColumnName("DESCRIPTION");
|
|
||||||
b.Property(e => e.Uri).HasColumnName("URI");
|
|
||||||
b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO");
|
|
||||||
b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN");
|
|
||||||
b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO");
|
|
||||||
b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<EndpointAuth>(b =>
|
|
||||||
{
|
|
||||||
b.ToTable("TBREC_CFG_ENDPOINT_AUTH");
|
|
||||||
|
|
||||||
b.HasKey(e => e.Id);
|
|
||||||
|
|
||||||
b.Property(e => e.Id)
|
|
||||||
.HasColumnName("GUID")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property(e => e.Active).HasColumnName("ACTIVE");
|
|
||||||
b.Property(e => e.Description).HasColumnName("DESCRIPTION");
|
|
||||||
b.Property(e => e.Type).HasColumnName("TYPE");
|
|
||||||
b.Property(e => e.ApiKey).HasColumnName("API_KEY");
|
|
||||||
b.Property(e => e.ApiValue).HasColumnName("API_VALUE");
|
|
||||||
b.Property(e => e.ApiKeyAddTo).HasColumnName("API_KEY_ADD_TO");
|
|
||||||
b.Property(e => e.Token).HasColumnName("TOKEN");
|
|
||||||
b.Property(e => e.Username).HasColumnName("USERNAME");
|
|
||||||
b.Property(e => e.Password).HasColumnName("PASSWORD");
|
|
||||||
b.Property(e => e.Domain).HasColumnName("DOMAIN");
|
|
||||||
b.Property(e => e.Workstation).HasColumnName("WORKSTATION");
|
|
||||||
b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO");
|
|
||||||
b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN");
|
|
||||||
b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO");
|
|
||||||
b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<EndpointParam>(b =>
|
|
||||||
{
|
|
||||||
b.ToTable("TBREC_CFG_ENDPOINT_PARAMS", "dbo");
|
|
||||||
|
|
||||||
b.HasKey(e => e.Id);
|
|
||||||
|
|
||||||
b.Property(e => e.Id).HasColumnName("GUID");
|
|
||||||
b.Property(e => e.Active).HasColumnName("ACTIVE");
|
|
||||||
b.Property(e => e.Description).HasColumnName("DESCRIPTION");
|
|
||||||
b.Property(e => e.GroupId).HasColumnName("GROUP_ID");
|
|
||||||
b.Property(e => e.Sequence).HasColumnName("SEQUENCE");
|
|
||||||
b.Property(e => e.Key).HasColumnName("KEY");
|
|
||||||
b.Property(e => e.Value).HasColumnName("VALUE");
|
|
||||||
b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO");
|
|
||||||
b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN");
|
|
||||||
b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO");
|
|
||||||
b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<OutRes>(b =>
|
|
||||||
{
|
|
||||||
b.ToTable("TBREC_OUT_RESULT", "dbo");
|
|
||||||
|
|
||||||
b.HasKey(e => e.Id);
|
|
||||||
|
|
||||||
b.Property(e => e.Id)
|
|
||||||
.HasColumnName("GUID")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property(e => e.ActionId).HasColumnName("ACTION_ID");
|
|
||||||
b.Property(e => e.Header).HasColumnName("RESULT_HEADER");
|
|
||||||
b.Property(e => e.Body).HasColumnName("RESULT_BODY");
|
|
||||||
b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO");
|
|
||||||
b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN");
|
|
||||||
b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO");
|
|
||||||
b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<Profile>(b =>
|
|
||||||
{
|
|
||||||
b.ToTable("TBREC_CFG_PROFILE", "dbo");
|
|
||||||
|
|
||||||
b.HasKey(e => e.Id);
|
|
||||||
|
|
||||||
b.Property(e => e.Id)
|
|
||||||
.HasColumnName("GUID")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property(e => e.Active).HasColumnName("ACTIVE");
|
|
||||||
b.Property(e => e.Type).HasColumnName("TYPE");
|
|
||||||
b.Property(e => e.Mandantor).HasColumnName("MANDANTOR");
|
|
||||||
b.Property(e => e.Name).HasColumnName("PROFILE_NAME");
|
|
||||||
b.Property(e => e.Description).HasColumnName("DESCRIPTION");
|
|
||||||
b.Property(e => e.LogLevel).HasColumnName("LOG_LEVEL");
|
|
||||||
b.Property(e => e.Language).HasColumnName("LANGUAGE");
|
|
||||||
b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO");
|
|
||||||
b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN");
|
|
||||||
b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO");
|
|
||||||
b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<RecAction>(b =>
|
|
||||||
{
|
|
||||||
b.ToTable("TBREC_CFG_ACTION");
|
|
||||||
|
|
||||||
b.HasKey(e => e.Id);
|
|
||||||
|
|
||||||
b.Property(e => e.Id).HasColumnName("GUID");
|
|
||||||
b.Property(e => e.ProfileId).HasColumnName("PROFILE_ID");
|
|
||||||
b.Property(e => e.Active).HasColumnName("ACTIVE");
|
|
||||||
b.Property(e => e.Sequence).HasColumnName("SEQUENCE");
|
|
||||||
b.Property(e => e.EndpointId).HasColumnName("ENDPOINT_ID");
|
|
||||||
b.Property(e => e.EndpointAuthId).HasColumnName("ENDPOINT_AUTH_ID");
|
|
||||||
b.Property(e => e.EndpointParamsId).HasColumnName("ENDPOINT_PARAMS_ID");
|
|
||||||
b.Property(e => e.SqlConnectionId).HasColumnName("SQL_CONNECTION_ID");
|
|
||||||
b.Property(e => e.Type).HasColumnName("TYPE");
|
|
||||||
b.Property(e => e.PreprocessingQuery).HasColumnName("PREPROCESSING_QUERY");
|
|
||||||
b.Property(e => e.HeaderQuery).HasColumnName("HEADER_QUERY");
|
|
||||||
b.Property(e => e.BodyQuery).HasColumnName("BODY_QUERY");
|
|
||||||
b.Property(e => e.PostprocessingQuery).HasColumnName("POSTPROCESSING_QUERY");
|
|
||||||
b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO");
|
|
||||||
b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN");
|
|
||||||
b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO");
|
|
||||||
b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN");
|
|
||||||
|
|
||||||
b.HasOne(act => act.OutRes)
|
|
||||||
.WithOne(res => res.Action)
|
.WithOne(res => res.Action)
|
||||||
.HasForeignKey<OutRes>(res => res.ActionId)
|
.HasForeignKey<OutRes>(res => res.ActionId);
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<RecActionView>(b =>
|
|
||||||
{
|
|
||||||
b.ToTable("VWREC_ACTION", "dbo");
|
|
||||||
b.HasNoKey();
|
|
||||||
|
|
||||||
b.Property(e => e.Id).HasColumnName("ACTION_ID");
|
|
||||||
b.Property(e => e.ProfileId).HasColumnName("PROFILE_ID");
|
|
||||||
b.Property(e => e.ProfileName).HasColumnName("PROFILE_NAME");
|
|
||||||
b.Property(e => e.ProfileType).HasColumnName("PROFILE_TYPE");
|
|
||||||
b.Property(e => e.Sequence).HasColumnName("SEQUENCE");
|
|
||||||
b.Property(e => e.EndpointId).HasColumnName("ENDPOINT_ID");
|
|
||||||
b.Property(e => e.EndpointUri).HasColumnName("ENDPOINT_URI");
|
|
||||||
b.Property(e => e.EndpointAuthId).HasColumnName("ENDPOINT_AUTH_ID");
|
|
||||||
b.Property(e => e.EndpointAuthType).HasColumnName("ENDPOINT_AUTH_TYPE");
|
|
||||||
b.Property(e => e.EndpointAuthApiKey).HasColumnName("ENDPOINT_AUTH_API_KEY");
|
|
||||||
b.Property(e => e.EndpointAuthApiValue).HasColumnName("ENDPOINT_AUTH_API_VALUE");
|
|
||||||
b.Property(e => e.EndpointAuthApiKeyAddTo).HasColumnName("ENDPOINT_AUTH_API_KEY_ADD_TO");
|
|
||||||
b.Property(e => e.EndpointAuthToken).HasColumnName("ENDPOINT_AUTH_TOKEN");
|
|
||||||
b.Property(e => e.EndpointAuthUsername).HasColumnName("ENDPOINT_AUTH_USERNAME");
|
|
||||||
b.Property(e => e.EndpointAuthPassword).HasColumnName("ENDPOINT_AUTH_PASSWORD");
|
|
||||||
b.Property(e => e.EndpointAuthDomain).HasColumnName("ENDPOINT_AUTH_DOMAIN");
|
|
||||||
b.Property(e => e.EndpointAuthWorkstation).HasColumnName("ENDPOINT_AUTH_WORKSTATION");
|
|
||||||
b.Property(e => e.EndpointParamsId).HasColumnName("ENDPOINT_PARAMS_ID");
|
|
||||||
b.Property(e => e.SqlConnectionId).HasColumnName("SQL_CONNECTION_ID");
|
|
||||||
b.Property(e => e.SqlConnectionServer).HasColumnName("SQL_CONNECTION_SERVER");
|
|
||||||
b.Property(e => e.SqlConnectionDb).HasColumnName("SQL_CONNECTION_DB");
|
|
||||||
b.Property(e => e.SqlConnectionUsername).HasColumnName("SQL_CONNECTION_USERNAME");
|
|
||||||
b.Property(e => e.SqlConnectionPassword).HasColumnName("SQL_CONNECTION_PASSWORD");
|
|
||||||
b.Property(e => e.RestType).HasColumnName("REST_TYPE");
|
|
||||||
b.Property(e => e.PreprocessingQuery).HasColumnName("PREPROCESSING_QUERY");
|
|
||||||
b.Property(e => e.HeaderQuery).HasColumnName("HEADER_QUERY");
|
|
||||||
b.Property(e => e.BodyQuery).HasColumnName("BODY_QUERY");
|
|
||||||
b.Property(e => e.PostprocessingQuery).HasColumnName("POSTPROCESSING_QUERY");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<HeaderQueryResult>(b =>
|
|
||||||
{
|
|
||||||
b.HasNoKey();
|
|
||||||
b.Property(e => e.RawHeader).HasColumnName("REQUEST_HEADER");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<BodyQueryResult>(b =>
|
|
||||||
{
|
|
||||||
b.HasNoKey();
|
|
||||||
b.Property(e => e.RawBody).HasColumnName("REQUEST_BODY");
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user