Compare commits
8 Commits
88cb1dc16a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 27d731a5b0 | |||
| b8f797f14d | |||
| 6feef53733 | |||
| 878e096c57 | |||
| 2ded140ad5 | |||
| e2ca249d13 | |||
| e782eab62a | |||
| d8e08b237d |
@@ -10,10 +10,10 @@
|
|||||||
<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.3-beta</Version>
|
<Version>2.0.0-beta</Version>
|
||||||
<AssemblyVersion>1.0.3.0</AssemblyVersion>
|
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
||||||
<FileVersion>1.0.3.0</FileVersion>
|
<FileVersion>2.0.0.0</FileVersion>
|
||||||
<InformationalVersion>1.0.3-beta</InformationalVersion>
|
<InformationalVersion>2.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>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||||
|
|||||||
@@ -8,11 +8,10 @@
|
|||||||
"RecAction": {
|
"RecAction": {
|
||||||
"MaxConcurrentInvocations": 5
|
"MaxConcurrentInvocations": 5
|
||||||
},
|
},
|
||||||
|
// Bad request SqlException numbers numbers can be updated at runtime; no restart required.
|
||||||
"SqlException": {
|
"SqlException": {
|
||||||
"ErrorMessages": {
|
// https://learn.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlexception.number
|
||||||
// https://learn.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlexception.number
|
"BadRequestSqlExceptionNumbers": [ 515, 547, 2601, 2627, 50000 ]
|
||||||
"SqlExceptionNumber": [ 515 , 547, 2601, 2627]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"AddedWho": "ReC.API",
|
"AddedWho": "ReC.API",
|
||||||
"FakeProfileId": 2
|
"FakeProfileId": 2
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public record RecActionViewDto
|
|||||||
|
|
||||||
public long? EndpointAuthId { get; init; }
|
public long? EndpointAuthId { get; init; }
|
||||||
|
|
||||||
public EndpointAuthType? EndpointAuthType { get; init; }
|
public EndpointAuthType EndpointAuthType { get; init; } = EndpointAuthType.NoAuth;
|
||||||
|
|
||||||
public string? EndpointAuthTypeName { get; init; }
|
public string? EndpointAuthTypeName { get; init; }
|
||||||
|
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ namespace ReC.Application.Common.Options;
|
|||||||
|
|
||||||
public class SqlExceptionOptions
|
public class SqlExceptionOptions
|
||||||
{
|
{
|
||||||
public HashSet<int> SqlExceptionNumber { get; set; } = [];
|
public HashSet<int> BadRequestSqlExceptionNumbers { get; set; } = [];
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ using DigitalData.Core.Abstraction.Application.Repository;
|
|||||||
using DigitalData.Core.Exceptions;
|
using DigitalData.Core.Exceptions;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using ReC.Application.Common.Exceptions;
|
using ReC.Application.Common.Exceptions;
|
||||||
using ReC.Application.Common.Options;
|
using ReC.Application.Common.Options;
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ public static class DeleteObjectProcedureExtensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeleteObjectProcedureHandler(IRepository repo, SqlExceptionOptions sqlExceptionOptions) : IRequestHandler<DeleteObjectProcedure, int>
|
public class DeleteObjectProcedureHandler(IRepository repo, IOptionsMonitor<SqlExceptionOptions> sqlExOpt) : IRequestHandler<DeleteObjectProcedure, int>
|
||||||
{
|
{
|
||||||
public async Task<int> Handle(DeleteObjectProcedure request, CancellationToken cancel)
|
public async Task<int> Handle(DeleteObjectProcedure request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
@@ -81,7 +82,7 @@ public class DeleteObjectProcedureHandler(IRepository repo, SqlExceptionOptions
|
|||||||
}
|
}
|
||||||
catch (SqlException ex)
|
catch (SqlException ex)
|
||||||
{
|
{
|
||||||
if (sqlExceptionOptions.SqlExceptionNumber.Contains(ex.Number))
|
if (sqlExOpt.CurrentValue.BadRequestSqlExceptionNumbers.Contains(ex.Number))
|
||||||
throw new BadRequestException(ex.Message, ex);
|
throw new BadRequestException(ex.Message, ex);
|
||||||
else
|
else
|
||||||
throw;
|
throw;
|
||||||
|
|||||||
@@ -2,13 +2,15 @@
|
|||||||
using DigitalData.Core.Exceptions;
|
using DigitalData.Core.Exceptions;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using ReC.Application.Common.Exceptions;
|
using ReC.Application.Common.Exceptions;
|
||||||
|
using ReC.Application.Common.Options;
|
||||||
using ReC.Application.EndpointAuth.Commands;
|
using ReC.Application.EndpointAuth.Commands;
|
||||||
using ReC.Application.EndpointParams.Commands;
|
using ReC.Application.EndpointParams.Commands;
|
||||||
using ReC.Application.Endpoints.Commands;
|
using ReC.Application.Endpoints.Commands;
|
||||||
using ReC.Application.Results.Commands;
|
|
||||||
using ReC.Application.Profile.Commands;
|
using ReC.Application.Profile.Commands;
|
||||||
using ReC.Application.Common.Options;
|
using ReC.Application.RecActions.Commands;
|
||||||
|
using ReC.Application.Results.Commands;
|
||||||
|
|
||||||
namespace ReC.Application.Common.Procedures.InsertProcedure;
|
namespace ReC.Application.Common.Procedures.InsertProcedure;
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ public static class InsertObjectProcedureExtensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InsertObjectProcedureHandler(IRepository repo, SqlExceptionOptions sqlExceptionOptions) : IRequestHandler<InsertObjectProcedure, long>
|
public class InsertObjectProcedureHandler(IRepository repo, IOptionsMonitor<SqlExceptionOptions> sqlExOpt) : IRequestHandler<InsertObjectProcedure, long>
|
||||||
{
|
{
|
||||||
public async Task<long> Handle(InsertObjectProcedure request, CancellationToken cancel)
|
public async Task<long> Handle(InsertObjectProcedure request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
@@ -61,7 +63,7 @@ public class InsertObjectProcedureHandler(IRepository repo, SqlExceptionOptions
|
|||||||
new SqlParameter("@pACTION_ENDPOINT_AUTH_ID", (object?)request.Action.EndpointAuthId ?? DBNull.Value),
|
new SqlParameter("@pACTION_ENDPOINT_AUTH_ID", (object?)request.Action.EndpointAuthId ?? DBNull.Value),
|
||||||
new SqlParameter("@pACTION_ENDPOINT_PARAMS_ID", (object?)request.Action.EndpointParamsId ?? DBNull.Value),
|
new SqlParameter("@pACTION_ENDPOINT_PARAMS_ID", (object?)request.Action.EndpointParamsId ?? DBNull.Value),
|
||||||
new SqlParameter("@pACTION_SQL_CONNECTION_ID", (object?)request.Action.SqlConnectionId ?? DBNull.Value),
|
new SqlParameter("@pACTION_SQL_CONNECTION_ID", (object?)request.Action.SqlConnectionId ?? DBNull.Value),
|
||||||
new SqlParameter("@pACTION_TYPE_ID", (object?)request.Action.TypeId ?? DBNull.Value),
|
new SqlParameter("@pACTION_TYPE_ID", (object?)(byte?)request.Action.TypeId ?? DBNull.Value),
|
||||||
new SqlParameter("@pACTION_PRE_SQL", (object?)request.Action.PreSql ?? DBNull.Value),
|
new SqlParameter("@pACTION_PRE_SQL", (object?)request.Action.PreSql ?? DBNull.Value),
|
||||||
new SqlParameter("@pACTION_HEADER_SQL", (object?)request.Action.HeaderSql ?? DBNull.Value),
|
new SqlParameter("@pACTION_HEADER_SQL", (object?)request.Action.HeaderSql ?? DBNull.Value),
|
||||||
new SqlParameter("@pACTION_BODY_SQL", (object?)request.Action.BodySql ?? DBNull.Value),
|
new SqlParameter("@pACTION_BODY_SQL", (object?)request.Action.BodySql ?? DBNull.Value),
|
||||||
@@ -129,7 +131,7 @@ public class InsertObjectProcedureHandler(IRepository repo, SqlExceptionOptions
|
|||||||
}
|
}
|
||||||
catch (SqlException ex)
|
catch (SqlException ex)
|
||||||
{
|
{
|
||||||
if (sqlExceptionOptions.SqlExceptionNumber.Contains(ex.Number))
|
if (sqlExOpt.CurrentValue.BadRequestSqlExceptionNumbers.Contains(ex.Number))
|
||||||
throw new BadRequestException(ex.Message, ex);
|
throw new BadRequestException(ex.Message, ex);
|
||||||
else
|
else
|
||||||
throw;
|
throw;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DigitalData.Core.Abstraction.Application.Repository;
|
|||||||
using DigitalData.Core.Exceptions;
|
using DigitalData.Core.Exceptions;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using ReC.Application.Common.Exceptions;
|
using ReC.Application.Common.Exceptions;
|
||||||
using ReC.Application.Common.Options;
|
using ReC.Application.Common.Options;
|
||||||
using ReC.Application.EndpointAuth.Commands;
|
using ReC.Application.EndpointAuth.Commands;
|
||||||
@@ -49,7 +50,7 @@ public static class UpdateObjectProcedureExtensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateObjectProcedureHandler(IRepository repo, SqlExceptionOptions sqlExceptionOptions) : IRequestHandler<UpdateObjectProcedure, int>
|
public class UpdateObjectProcedureHandler(IRepository repo, IOptionsMonitor<SqlExceptionOptions> sqlExOpt) : IRequestHandler<UpdateObjectProcedure, int>
|
||||||
{
|
{
|
||||||
public async Task<int> Handle(UpdateObjectProcedure request, CancellationToken cancel)
|
public async Task<int> Handle(UpdateObjectProcedure request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
@@ -141,7 +142,7 @@ public class UpdateObjectProcedureHandler(IRepository repo, SqlExceptionOptions
|
|||||||
}
|
}
|
||||||
catch (SqlException ex)
|
catch (SqlException ex)
|
||||||
{
|
{
|
||||||
if (sqlExceptionOptions.SqlExceptionNumber.Contains(ex.Number))
|
if (sqlExOpt.CurrentValue.BadRequestSqlExceptionNumbers.Contains(ex.Number))
|
||||||
throw new BadRequestException(ex.Message, ex);
|
throw new BadRequestException(ex.Message, ex);
|
||||||
else
|
else
|
||||||
throw;
|
throw;
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace ReC.Application.Common.Procedures.InsertProcedure;
|
using ReC.Application.Common.Procedures.InsertProcedure;
|
||||||
|
using ReC.Domain.Constants;
|
||||||
|
|
||||||
|
namespace ReC.Application.RecActions.Commands;
|
||||||
|
|
||||||
public record InsertActionProcedure : IInsertProcedure
|
public record InsertActionProcedure : IInsertProcedure
|
||||||
{
|
{
|
||||||
@@ -9,7 +12,7 @@ public record InsertActionProcedure : IInsertProcedure
|
|||||||
public long? EndpointAuthId { get; set; }
|
public long? EndpointAuthId { get; set; }
|
||||||
public short? EndpointParamsId { get; set; }
|
public short? EndpointParamsId { get; set; }
|
||||||
public short? SqlConnectionId { get; set; }
|
public short? SqlConnectionId { get; set; }
|
||||||
public byte? TypeId { get; set; }
|
public RestType? TypeId { get; set; }
|
||||||
public string? PreSql { get; set; }
|
public string? PreSql { get; set; }
|
||||||
public string? HeaderSql { get; set; }
|
public string? HeaderSql { get; set; }
|
||||||
public string? BodySql { get; set; }
|
public string? BodySql { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user