refactor(Infrastructure): update Executor, Migrations and Repositories to be compiled only in .NET
This commit is contained in:
parent
167ea1444b
commit
12063f36de
@ -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;
|
||||||
@ -22,10 +23,10 @@ namespace EnvelopeGenerator.Infrastructure
|
|||||||
// create DbTriggerParams
|
// create DbTriggerParams
|
||||||
var triggerLists = config.GetSection("DbTriggerParams").Get<Dictionary<string, List<string>>>();
|
var triggerLists = config.GetSection("DbTriggerParams").Get<Dictionary<string, List<string>>>();
|
||||||
var dbTriggerParams = new DbTriggerParams();
|
var dbTriggerParams = new DbTriggerParams();
|
||||||
if(triggerLists is not null)
|
if (triggerLists is not null)
|
||||||
foreach (var triggerList in triggerLists)
|
foreach (var triggerList in triggerLists)
|
||||||
{
|
{
|
||||||
if(triggerList.Value.Count == 0)
|
if (triggerList.Value.Count == 0)
|
||||||
continue; // Skip empty trigger lists
|
continue; // Skip empty trigger lists
|
||||||
|
|
||||||
var tableName = triggerList.Key;
|
var tableName = triggerList.Key;
|
||||||
@ -43,4 +44,5 @@ namespace EnvelopeGenerator.Infrastructure
|
|||||||
return dbContext;
|
return dbContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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
|
||||||
@ -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;
|
||||||
@ -36,4 +37,5 @@ public class EnvelopeExecutor : SQLExecutor, IEnvelopeExecutor
|
|||||||
|
|
||||||
return envelope;
|
return envelope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
@ -9,7 +10,7 @@ using Microsoft.Extensions.Options;
|
|||||||
|
|
||||||
namespace EnvelopeGenerator.Infrastructure.Executor;
|
namespace EnvelopeGenerator.Infrastructure.Executor;
|
||||||
|
|
||||||
public class EnvelopeReceiverExecutor: SQLExecutor, IEnvelopeReceiverExecutor
|
public class EnvelopeReceiverExecutor : SQLExecutor, IEnvelopeReceiverExecutor
|
||||||
{
|
{
|
||||||
private readonly IEnvelopeReceiverRepository _erRepository;
|
private readonly IEnvelopeReceiverRepository _erRepository;
|
||||||
|
|
||||||
@ -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
|
||||||
@ -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;
|
||||||
@ -38,4 +39,5 @@ 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
|
||||||
@ -1,4 +1,5 @@
|
|||||||
namespace EnvelopeGenerator.Infrastructure.Executor;
|
#if NET
|
||||||
|
namespace EnvelopeGenerator.Infrastructure.Executor;
|
||||||
|
|
||||||
public static class QueryExtension
|
public static class QueryExtension
|
||||||
{
|
{
|
||||||
@ -6,4 +7,5 @@ public static class QueryExtension
|
|||||||
{
|
{
|
||||||
return new Query<TEntity>(queryable);
|
return new Query<TEntity>(queryable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
@ -30,4 +31,5 @@ public class SQLExecutor : ISQLExecutor
|
|||||||
var sql = Provider.GetRequiredService<TSQL>();
|
var sql = Provider.GetRequiredService<TSQL>();
|
||||||
return Execute<TEntity>(sql.Raw, parameters, cancellation);
|
return Execute<TEntity>(sql.Raw, parameters, cancellation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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
|
||||||
@ -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
|
||||||
File diff suppressed because it is too large
Load Diff
@ -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
|
||||||
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||||
@ -17,4 +18,5 @@ public class ConfigRepository : CRUDRepository<Config, int, EGDbContext>, IConfi
|
|||||||
var configs = await _dbSet.ToListAsync();
|
var configs = await _dbSet.ToListAsync();
|
||||||
return configs.Count > 0 ? configs[0] : default;
|
return configs.Count > 0 ? configs[0] : default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
|
|
||||||
@ -10,4 +11,5 @@ public class DocumentReceiverElementRepository : CRUDRepository<Signature, int,
|
|||||||
public DocumentReceiverElementRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentReceiverElements)
|
public DocumentReceiverElementRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentReceiverElements)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
|
|
||||||
@ -10,4 +11,5 @@ public class DocumentStatusRepository : CRUDRepository<DocumentStatus, int, EGDb
|
|||||||
public DocumentStatusRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentStatus)
|
public DocumentStatusRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentStatus)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
@ -9,26 +10,27 @@ namespace EnvelopeGenerator.Infrastructure.Repositories;
|
|||||||
|
|
||||||
[Obsolete("Use TempRepo")]
|
[Obsolete("Use TempRepo")]
|
||||||
public class EmailTemplateRepository : CRUDRepository<EmailTemplate, int, EGDbContext>, IEmailTemplateRepository
|
public class EmailTemplateRepository : CRUDRepository<EmailTemplate, int, EGDbContext>, IEmailTemplateRepository
|
||||||
|
{
|
||||||
|
private readonly IMemoryCache _cache;
|
||||||
|
|
||||||
|
public EmailTemplateRepository(EGDbContext dbContext, IMemoryCache cache) : base(dbContext, dbContext.EmailTemplate)
|
||||||
{
|
{
|
||||||
private readonly IMemoryCache _cache;
|
_cache = cache;
|
||||||
|
}
|
||||||
|
|
||||||
public EmailTemplateRepository(EGDbContext dbContext, IMemoryCache cache) : base(dbContext, dbContext.EmailTemplate)
|
private readonly Guid key_guid = Guid.NewGuid();
|
||||||
{
|
|
||||||
_cache = cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Guid key_guid = Guid.NewGuid();
|
/// <summary>
|
||||||
|
/// Retrieves an email template based on its name.
|
||||||
/// <summary>
|
/// Utilizes in-memory caching to improve performance for the limited number of email templates available.
|
||||||
/// Retrieves an email template based on its name.
|
/// If the template is not found in the cache, it queries the database and stores the result in the cache.
|
||||||
/// Utilizes in-memory caching to improve performance for the limited number of email templates available.
|
/// </summary>
|
||||||
/// If the template is not found in the cache, it queries the database and stores the result in the cache.
|
/// <param name="type">The type of the email template, which corresponds to its name.</param>
|
||||||
/// </summary>
|
/// <returns>
|
||||||
/// <param name="type">The type of the email template, which corresponds to its name.</param>
|
/// A task that represents the asynchronous operation. The task result contains the email template
|
||||||
/// <returns>
|
/// if found, otherwise null.
|
||||||
/// A task that represents the asynchronous operation. The task result contains the email template
|
/// </returns>
|
||||||
/// if found, otherwise null.
|
public async Task<EmailTemplate?> ReadByNameAsync(EmailTemplateType type) => await _cache.GetOrCreateAsync($"{type}{key_guid}", async _
|
||||||
/// </returns>
|
|
||||||
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
|
||||||
@ -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;
|
||||||
|
|
||||||
@ -10,4 +11,5 @@ public class EnvelopeDocumentRepository : CRUDRepository<Document, int, EGDbCont
|
|||||||
public EnvelopeDocumentRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeDocument)
|
public EnvelopeDocumentRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeDocument)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
@ -47,4 +48,5 @@ public class EnvelopeHistoryRepository : CRUDRepository<History, long, EGDbConte
|
|||||||
status: status,
|
status: status,
|
||||||
withSender: withSender,
|
withSender: withSender,
|
||||||
withReceiver: withReceiver).ToListAsync();
|
withReceiver: withReceiver).ToListAsync();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
@ -52,7 +53,7 @@ public class EnvelopeReceiverReadOnlyRepository : CRUDRepository<EnvelopeReceive
|
|||||||
private async Task<IEnumerable<EnvelopeReceiverReadOnly>> IncludeEnvelope(params EnvelopeReceiverReadOnly[] erros)
|
private async Task<IEnumerable<EnvelopeReceiverReadOnly>> IncludeEnvelope(params EnvelopeReceiverReadOnly[] erros)
|
||||||
{
|
{
|
||||||
foreach (var erro in erros)
|
foreach (var erro in erros)
|
||||||
erro.Envelope = await _envRepo.ReadByIdAsync((int) erro.EnvelopeId);
|
erro.Envelope = await _envRepo.ReadByIdAsync((int)erro.EnvelopeId);
|
||||||
|
|
||||||
return erros;
|
return erros;
|
||||||
}
|
}
|
||||||
@ -67,4 +68,5 @@ public class EnvelopeReceiverReadOnlyRepository : CRUDRepository<EnvelopeReceive
|
|||||||
|
|
||||||
return erros;
|
return erros;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
|
|
||||||
@ -64,4 +64,5 @@ public class EnvelopeRepository : CRUDRepository<Envelope, int, EGDbContext>, IE
|
|||||||
|
|
||||||
return await query.ToListAsync();
|
return await query.ToListAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
|
|
||||||
@ -10,4 +11,5 @@ public class EnvelopeTypeRepository : CRUDRepository<EnvelopeType, int, EGDbCont
|
|||||||
public EnvelopeTypeRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeTypes)
|
public EnvelopeTypeRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeTypes)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ public class EnvelopeReceiverRepository : CRUDRepository<EnvelopeReceiver, (int
|
|||||||
private IQueryable<EnvelopeReceiver> ReadById(int envelopeId, int receiverId, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true)
|
private IQueryable<EnvelopeReceiver> ReadById(int envelopeId, int receiverId, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true)
|
||||||
{
|
{
|
||||||
var query = readOnly ? _dbSet.AsNoTracking() : _dbSet;
|
var query = readOnly ? _dbSet.AsNoTracking() : _dbSet;
|
||||||
|
|
||||||
if (withEnvelope)
|
if (withEnvelope)
|
||||||
query = query
|
query = query
|
||||||
.Include(er => er.Envelope).ThenInclude(e => e!.Documents!).ThenInclude(d => d.Elements!.Where(e => e.Receiver!.Id == receiverId))
|
.Include(er => er.Envelope).ThenInclude(e => e!.Documents!).ThenInclude(d => d.Elements!.Where(e => e.Receiver!.Id == receiverId))
|
||||||
@ -108,7 +108,7 @@ public class EnvelopeReceiverRepository : CRUDRepository<EnvelopeReceiver, (int
|
|||||||
|
|
||||||
var query = _dbSet.AsNoTracking();
|
var query = _dbSet.AsNoTracking();
|
||||||
|
|
||||||
if(email is not null)
|
if (email is not null)
|
||||||
query = query.Where(er => er.Receiver!.EmailAddress == email);
|
query = query.Where(er => er.Receiver!.EmailAddress == email);
|
||||||
|
|
||||||
if (id is not null)
|
if (id is not null)
|
||||||
@ -118,5 +118,6 @@ public class EnvelopeReceiverRepository : CRUDRepository<EnvelopeReceiver, (int
|
|||||||
query = query.Where(er => er.Receiver!.Signature == signature);
|
query = query.Where(er => er.Receiver!.Signature == signature);
|
||||||
|
|
||||||
return await query.OrderBy(er => er.EnvelopeId).LastOrDefaultAsync();
|
return await query.OrderBy(er => er.EnvelopeId).LastOrDefaultAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -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;
|
||||||
@ -16,10 +17,10 @@ public class ReceiverRepository : CRUDRepository<Receiver, int, EGDbContext>, IR
|
|||||||
{
|
{
|
||||||
IQueryable<Receiver> query = _dbSet.AsNoTracking();
|
IQueryable<Receiver> query = _dbSet.AsNoTracking();
|
||||||
|
|
||||||
if(emailAddress is not null)
|
if (emailAddress is not null)
|
||||||
query = query.Where(r => r.EmailAddress == emailAddress);
|
query = query.Where(r => r.EmailAddress == emailAddress);
|
||||||
|
|
||||||
if(signature is not null)
|
if (signature is not null)
|
||||||
query = query.Where(r => r.Signature == signature);
|
query = query.Where(r => r.Signature == signature);
|
||||||
|
|
||||||
// envelope receivers are ignored (with '[JsonIgnore]' attribute). The reson to add them is to get the las used receiver name
|
// envelope receivers are ignored (with '[JsonIgnore]' attribute). The reson to add them is to get the las used receiver name
|
||||||
@ -34,4 +35,5 @@ public class ReceiverRepository : CRUDRepository<Receiver, int, EGDbContext>, IR
|
|||||||
public async Task<Receiver?> ReadByAsync(string? emailAddress = null, string? signature = null) => await ReadBy(emailAddress, signature).FirstOrDefaultAsync();
|
public async Task<Receiver?> ReadByAsync(string? emailAddress = null, string? signature = null) => await ReadBy(emailAddress, signature).FirstOrDefaultAsync();
|
||||||
|
|
||||||
public async override Task<IEnumerable<Receiver>> ReadAllAsync() => await ReadBy().ToListAsync();
|
public async override Task<IEnumerable<Receiver>> ReadAllAsync() => await ReadBy().ToListAsync();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
Loading…
x
Reference in New Issue
Block a user