refactor(Infrastructure): update Executor, Migrations and Repositories to be compiled only in .NET

This commit is contained in:
2025-10-01 10:36:57 +02:00
parent 167ea1444b
commit 12063f36de
23 changed files with 2344 additions and 2298 deletions

View File

@@ -1,4 +1,5 @@
using EnvelopeGenerator.Application.Common.Configurations; #if NET
using EnvelopeGenerator.Application.Common.Configurations;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design; using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
@@ -44,3 +45,4 @@ namespace EnvelopeGenerator.Infrastructure
} }
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using Dapper; #if NET
using Dapper;
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor; using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
using EnvelopeGenerator.Application.Common.SQL; using EnvelopeGenerator.Application.Common.SQL;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
@@ -27,3 +28,4 @@ public class DocumentExecutor : SQLExecutor, IDocumentExecutor
$"base64={base64}, envelope_uuid='{envelope_uuid}'."); $"base64={base64}, envelope_uuid='{envelope_uuid}'.");
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using Dapper; #if NET
using Dapper;
using DigitalData.UserManager.Application.Contracts.Repositories; using DigitalData.UserManager.Application.Contracts.Repositories;
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor; using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
using EnvelopeGenerator.Application.Common.SQL; using EnvelopeGenerator.Application.Common.SQL;
@@ -37,3 +38,4 @@ public class EnvelopeExecutor : SQLExecutor, IEnvelopeExecutor
return envelope; return envelope;
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using Dapper; #if NET
using Dapper;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor; using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
using EnvelopeGenerator.Application.Common.SQL; using EnvelopeGenerator.Application.Common.SQL;
@@ -33,3 +34,4 @@ public class EnvelopeReceiverExecutor: SQLExecutor, IEnvelopeReceiverExecutor
return await _erRepository.ReadByIdAsync(envelopeId: er.EnvelopeId, receiverId: er.ReceiverId); return await _erRepository.ReadByIdAsync(envelopeId: er.EnvelopeId, receiverId: er.ReceiverId);
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor; #if NET
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace EnvelopeGenerator.Infrastructure.Executor; namespace EnvelopeGenerator.Infrastructure.Executor;
@@ -39,3 +40,4 @@ public sealed record Query<TEntity> : IQuery<TEntity>
public async Task<IEnumerable<TEntity>> ToListAsync() => await _query.ToListAsync(); public async Task<IEnumerable<TEntity>> ToListAsync() => await _query.ToListAsync();
} }
#endif

View File

@@ -1,4 +1,5 @@
namespace EnvelopeGenerator.Infrastructure.Executor; #if NET
namespace EnvelopeGenerator.Infrastructure.Executor;
public static class QueryExtension public static class QueryExtension
{ {
@@ -7,3 +8,4 @@ public static class QueryExtension
return new Query<TEntity>(queryable); return new Query<TEntity>(queryable);
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using Dapper; #if NET
using Dapper;
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor; using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
using Microsoft.Data.SqlClient; using Microsoft.Data.SqlClient;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@@ -31,3 +32,4 @@ public class SQLExecutor : ISQLExecutor
return Execute<TEntity>(sql.Raw, parameters, cancellation); return Execute<TEntity>(sql.Raw, parameters, cancellation);
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor; #if NET
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@@ -29,3 +30,5 @@ public sealed class SQLExecutor<T> : SQLExecutor, ISQLExecutor<T> where T : clas
return Execute(sql.Raw); return Execute(sql.Raw);
} }
} }
#endif

View File

@@ -1,6 +1,9 @@
namespace EnvelopeGenerator.Infrastructure.Executor; #if NET
namespace EnvelopeGenerator.Infrastructure.Executor;
public class SQLExecutorParams public class SQLExecutorParams
{ {
public string? ConnectionString { get; set; } public string? ConnectionString { get; set; }
} }
#endif

View File

@@ -1,4 +1,5 @@
// <auto-generated /> #if NET
// <auto-generated />
using System; using System;
using EnvelopeGenerator.Infrastructure; using EnvelopeGenerator.Infrastructure;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@@ -1378,3 +1379,4 @@ namespace EnvelopeGenerator.Infrastructure.Migrations
} }
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using System; #if NET
using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
@@ -809,3 +810,4 @@ namespace EnvelopeGenerator.Infrastructure.Migrations
} }
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
// <auto-generated /> #if NET
// <auto-generated />
using System; using System;
using EnvelopeGenerator.Infrastructure; using EnvelopeGenerator.Infrastructure;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@@ -1375,3 +1376,4 @@ namespace EnvelopeGenerator.Infrastructure.Migrations
} }
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -18,3 +19,4 @@ public class ConfigRepository : CRUDRepository<Config, int, EGDbContext>, IConfi
return configs.Count > 0 ? configs[0] : default; return configs.Count > 0 ? configs[0] : default;
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -11,3 +12,4 @@ public class DocumentReceiverElementRepository : CRUDRepository<Signature, int,
{ {
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -11,3 +12,4 @@ public class DocumentStatusRepository : CRUDRepository<DocumentStatus, int, EGDb
{ {
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Caching.Memory;
@@ -32,3 +33,4 @@ public class EmailTemplateRepository : CRUDRepository<EmailTemplate, int, EGDbCo
public async Task<EmailTemplate?> ReadByNameAsync(EmailTemplateType type) => await _cache.GetOrCreateAsync($"{type}{key_guid}", async _ public async Task<EmailTemplate?> ReadByNameAsync(EmailTemplateType type) => await _cache.GetOrCreateAsync($"{type}{key_guid}", async _
=> await _dbSet.Where(t => t.Name == type.ToString()).FirstOrDefaultAsync()); => await _dbSet.Where(t => t.Name == type.ToString()).FirstOrDefaultAsync());
} }
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -11,3 +12,4 @@ public class EnvelopeDocumentRepository : CRUDRepository<Document, int, EGDbCont
{ {
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using EnvelopeGenerator.Domain.Constants; using EnvelopeGenerator.Domain.Constants;
@@ -48,3 +49,4 @@ public class EnvelopeHistoryRepository : CRUDRepository<History, long, EGDbConte
withSender: withSender, withSender: withSender,
withReceiver: withReceiver).ToListAsync(); withReceiver: withReceiver).ToListAsync();
} }
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -68,3 +69,4 @@ public class EnvelopeReceiverReadOnlyRepository : CRUDRepository<EnvelopeReceive
return erros; return erros;
} }
} }
#endif

View File

@@ -1,7 +1,7 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using EnvelopeGenerator.Domain;
using EnvelopeGenerator.Domain.Constants; using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -65,3 +65,4 @@ public class EnvelopeRepository : CRUDRepository<Envelope, int, EGDbContext>, IE
return await query.ToListAsync(); return await query.ToListAsync();
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -11,3 +12,4 @@ public class EnvelopeTypeRepository : CRUDRepository<EnvelopeType, int, EGDbCont
{ {
} }
} }
#endif

View File

@@ -1,8 +1,8 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using DigitalData.Core.Exceptions; using DigitalData.Core.Exceptions;
using EnvelopeGenerator.Domain;
using EnvelopeGenerator.Domain.Constants; using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -120,3 +120,4 @@ public class EnvelopeReceiverRepository : CRUDRepository<EnvelopeReceiver, (int
return await query.OrderBy(er => er.EnvelopeId).LastOrDefaultAsync(); return await query.OrderBy(er => er.EnvelopeId).LastOrDefaultAsync();
} }
} }
#endif

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Infrastructure; #if NET
using DigitalData.Core.Infrastructure;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using EnvelopeGenerator.Application.Common.Interfaces.Repositories; using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
@@ -35,3 +36,4 @@ public class ReceiverRepository : CRUDRepository<Receiver, int, EGDbContext>, IR
public async override Task<IEnumerable<Receiver>> ReadAllAsync() => await ReadBy().ToListAsync(); public async override Task<IEnumerable<Receiver>> ReadAllAsync() => await ReadBy().ToListAsync();
} }
#endif