|
|
@ -4,15 +4,17 @@ using SqlSugar;
|
|
|
|
namespace Infrastructure.Repository;
|
|
|
|
namespace Infrastructure.Repository;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// <inheritdoc cref="IServiceBase{T}"/>
|
|
|
|
/// <inheritdoc cref="IServiceBase{T,TId}"/>
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="dbContext"></param>
|
|
|
|
/// <param name="dbContext"></param>
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
public abstract class ServiceBase<T>(IRepositoryBase<T> dbContext) : IServiceBase<T> where T : class, new()
|
|
|
|
/// <typeparam name="TId"></typeparam>
|
|
|
|
|
|
|
|
public abstract class ServiceBase<T, TId>(IRepositoryBase<T, TId> dbContext)
|
|
|
|
|
|
|
|
: IServiceBase<T, TId> where T : class, new() where TId : IEquatable<TId>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public IRepositoryBase<T> DAL { get; } = dbContext;
|
|
|
|
public IRepositoryBase<T, TId> DAL { get; } = dbContext;
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<T?> GetByIdAsync(long id)
|
|
|
|
public async Task<T?> GetByIdAsync(TId id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return await DAL.GetByIdAsync(id);
|
|
|
|
return await DAL.GetByIdAsync(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|