Enhance framework compatibility and code readability
Added preprocessor directives for .NET framework compatibility. Modified `using` directives to be framework-specific. Improved code formatting for better readability. Introduced obsolete attributes for deprecated methods, recommending `MediatR` as an alternative. Added XML documentation for clarity and maintainability.
This commit is contained in:
parent
07ab7f0c62
commit
74a625a863
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
#if NET
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
|
||||||
@ -32,3 +33,4 @@ public static class DIExtensions
|
|||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
#if NET
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace DigitalData.Core.Abstraction.Application.DTO;
|
namespace DigitalData.Core.Abstraction.Application.DTO;
|
||||||
@ -391,3 +392,4 @@ public static class DTOExtensions
|
|||||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||||
public static bool IsWrong(this DataResult<bool> bResult) => !bResult.Data;
|
public static bool IsWrong(this DataResult<bool> bResult) => !bResult.Data;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -1,4 +1,5 @@
|
|||||||
namespace DigitalData.Core.Abstraction.Application.DTO;
|
#if NET
|
||||||
|
namespace DigitalData.Core.Abstraction.Application.DTO;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines flags that indicate specific types of status or conditions in a service operation.
|
/// Defines flags that indicate specific types of status or conditions in a service operation.
|
||||||
@ -48,3 +49,4 @@ public enum Flag
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
NotFound
|
NotFound
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
#if NET
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DigitalData.Core.Abstraction.Application.DTO;
|
namespace DigitalData.Core.Abstraction.Application.DTO;
|
||||||
|
|
||||||
@ -26,3 +27,4 @@ public class Notice
|
|||||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||||
public List<string> Messages { get; init; } = new();
|
public List<string> Messages { get; init; } = new();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Text.Json.Serialization;
|
#if NET
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace DigitalData.Core.Abstraction.Application.DTO;
|
namespace DigitalData.Core.Abstraction.Application.DTO;
|
||||||
|
|
||||||
@ -106,3 +107,4 @@ public class Result
|
|||||||
};
|
};
|
||||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -1,4 +1,5 @@
|
|||||||
namespace DigitalData.Core.Abstraction.Application;
|
#if NET
|
||||||
|
namespace DigitalData.Core.Abstraction.Application;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides extension methods for retrieving the value of an 'Id' property from objects.
|
/// Provides extension methods for retrieving the value of an 'Id' property from objects.
|
||||||
@ -92,3 +93,4 @@ public static class EntityExtensions
|
|||||||
return id is not null;
|
return id is not null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -1,4 +1,5 @@
|
|||||||
namespace DigitalData.Core.Abstraction.Application
|
#if NET
|
||||||
|
namespace DigitalData.Core.Abstraction.Application
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implements a simplified CRUD service interface that uses a single Data Transfer Object (DTO) type for all CRUD operations,
|
/// Implements a simplified CRUD service interface that uses a single Data Transfer Object (DTO) type for all CRUD operations,
|
||||||
@ -19,3 +20,4 @@
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -1,7 +1,8 @@
|
|||||||
using DigitalData.Core.Abstraction.Application.DTO;
|
#if NET
|
||||||
|
using DigitalData.Core.Abstraction.Application.DTO;
|
||||||
|
|
||||||
|
namespace DigitalData.Core.Abstraction.Application;
|
||||||
|
|
||||||
namespace DigitalData.Core.Abstraction.Application
|
|
||||||
{
|
|
||||||
[Obsolete("Use MediatR")]
|
[Obsolete("Use MediatR")]
|
||||||
public interface ICRUDService<TCreateDto, TReadDto, TEntity, TId> : IReadService<TReadDto, TEntity, TId>
|
public interface ICRUDService<TCreateDto, TReadDto, TEntity, TId> : IReadService<TReadDto, TEntity, TId>
|
||||||
where TCreateDto : class where TReadDto : class where TEntity : class
|
where TCreateDto : class where TReadDto : class where TEntity : class
|
||||||
@ -22,4 +23,4 @@ namespace DigitalData.Core.Abstraction.Application
|
|||||||
/// <returns>An Result indicating the outcome of the update operation, with an appropriate message.</returns>
|
/// <returns>An Result indicating the outcome of the update operation, with an appropriate message.</returns>
|
||||||
Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto);
|
Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
@ -1,8 +1,10 @@
|
|||||||
using DigitalData.Core.Abstraction.Application.DTO;
|
#if NET
|
||||||
|
using DigitalData.Core.Abstraction.Application.DTO;
|
||||||
using System.DirectoryServices;
|
using System.DirectoryServices;
|
||||||
|
|
||||||
namespace DigitalData.Core.Abstraction.Application
|
namespace DigitalData.Core.Abstraction.Application;
|
||||||
{
|
|
||||||
|
[Obsolete("Use DigitalData.ActiveDirectory")]
|
||||||
public interface IDirectorySearchService
|
public interface IDirectorySearchService
|
||||||
{
|
{
|
||||||
public string ServerName { get; }
|
public string ServerName { get; }
|
||||||
@ -91,4 +93,4 @@ namespace DigitalData.Core.Abstraction.Application
|
|||||||
/// <returns>The cached <see cref="DirectoryEntry"/> if found; otherwise, null.</returns>
|
/// <returns>The cached <see cref="DirectoryEntry"/> if found; otherwise, null.</returns>
|
||||||
DirectoryEntry? GetSearchRootCache(string username);
|
DirectoryEntry? GetSearchRootCache(string username);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
@ -1,9 +1,10 @@
|
|||||||
using Microsoft.IdentityModel.Tokens;
|
#if NET
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
namespace DigitalData.Core.Abstraction.Application
|
namespace DigitalData.Core.Abstraction.Application;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the operations for JWT service handling claims of type <typeparamref name="TClaimValue"/>.
|
/// Defines the operations for JWT service handling claims of type <typeparamref name="TClaimValue"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -38,4 +39,4 @@ namespace DigitalData.Core.Abstraction.Application
|
|||||||
/// <returns>A <see cref="JwtSecurityToken"/> if the token is valid; otherwise, null.</returns>
|
/// <returns>A <see cref="JwtSecurityToken"/> if the token is valid; otherwise, null.</returns>
|
||||||
JwtSecurityToken? ReadSecurityToken(string token);
|
JwtSecurityToken? ReadSecurityToken(string token);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
@ -1,7 +1,8 @@
|
|||||||
using DigitalData.Core.Abstraction.Application.DTO;
|
#if NET
|
||||||
|
using DigitalData.Core.Abstraction.Application.DTO;
|
||||||
|
|
||||||
|
namespace DigitalData.Core.Abstraction.Application;
|
||||||
|
|
||||||
namespace DigitalData.Core.Abstraction.Application
|
|
||||||
{
|
|
||||||
[Obsolete("Use MediatR")]
|
[Obsolete("Use MediatR")]
|
||||||
public interface IReadService<TReadDto, TEntity, TId>
|
public interface IReadService<TReadDto, TEntity, TId>
|
||||||
where TReadDto : class where TEntity : class
|
where TReadDto : class where TEntity : class
|
||||||
@ -36,4 +37,4 @@ namespace DigitalData.Core.Abstraction.Application
|
|||||||
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the entity exists.</returns>
|
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the entity exists.</returns>
|
||||||
Task<bool> HasEntity(TId id);
|
Task<bool> HasEntity(TId id);
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
@ -1,4 +1,5 @@
|
|||||||
namespace DigitalData.Core.Abstraction.Application.Repository
|
#if NET
|
||||||
|
namespace DigitalData.Core.Abstraction.Application.Repository
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the contract for CRUD operations on a repository for entities of type TEntity.
|
/// Defines the contract for CRUD operations on a repository for entities of type TEntity.
|
||||||
@ -61,3 +62,4 @@
|
|||||||
Task<int> CountAsync(TId id);
|
Task<int> CountAsync(TId id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@ -1,4 +1,7 @@
|
|||||||
namespace DigitalData.Core.Abstraction.Application.Repository
|
#if NETFRAMEWORK
|
||||||
|
using System.Collections.Generic;
|
||||||
|
#endif
|
||||||
|
namespace DigitalData.Core.Abstraction.Application.Repository
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines methods for mapping between entities and Data Transfer Objects (DTOs).
|
/// Defines methods for mapping between entities and Data Transfer Objects (DTOs).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user