Add conditional compilation for .NET Framework support
Introduce conditional compilation directives in the IRepository interface to support .NET Framework. Update method signatures to conditionally include the `public` access modifier for compatibility across frameworks. Adjust the Entity method to remove the `public` modifier, enhancing flexibility while maintaining existing functionality.
This commit is contained in:
parent
74a625a863
commit
d4d1d2b69f
@ -1,50 +1,105 @@
|
||||
using DigitalData.Core.Abstractions.Interfaces;
|
||||
using System.Linq.Expressions;
|
||||
#if NETFRAMEWORK
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
#endif
|
||||
|
||||
namespace DigitalData.Core.Abstraction.Application.Repository;
|
||||
namespace DigitalData.Core.Abstraction.Application.Repository
|
||||
#if NET
|
||||
;
|
||||
#elif NETFRAMEWORK
|
||||
{
|
||||
#endif
|
||||
|
||||
public interface IRepository<TEntity>
|
||||
{
|
||||
#region Create
|
||||
public Task<TEntity> CreateAsync(TEntity entity, CancellationToken cancel = default);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task<TEntity> CreateAsync(TEntity entity, CancellationToken cancel = default);
|
||||
|
||||
public Task<IEnumerable<TEntity>> CreateAsync(IEnumerable<TEntity> entities, CancellationToken cancel = default);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task<IEnumerable<TEntity>> CreateAsync(IEnumerable<TEntity> entities, CancellationToken cancel = default);
|
||||
|
||||
public Task<TEntity> CreateAsync<TDto>(TDto dto, CancellationToken cancel = default);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task<TEntity> CreateAsync<TDto>(TDto dto, CancellationToken cancel = default);
|
||||
|
||||
public Task<IEnumerable<TEntity>> CreateAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken cancel = default);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task<IEnumerable<TEntity>> CreateAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken cancel = default);
|
||||
#endregion Create
|
||||
|
||||
#region Read
|
||||
public IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression);
|
||||
|
||||
public IEnumerable<TEntity> GetAll();
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
IEnumerable<TEntity> GetAll();
|
||||
|
||||
public Task<IEnumerable<TEntity>> GetAllAsync(CancellationToken cancel = default);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task<IEnumerable<TEntity>> GetAllAsync(CancellationToken cancel = default);
|
||||
#endregion Read
|
||||
|
||||
#region Update
|
||||
public Task UpdateAsync<TDto>(TDto dto, Expression<Func<TEntity, bool>> expression, CancellationToken cancel = default);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task UpdateAsync<TDto>(TDto dto, Expression<Func<TEntity, bool>> expression, CancellationToken cancel = default);
|
||||
|
||||
public Task UpdateAsync<TDto>(TDto dto, Func<IQueryable<TEntity>, IQueryable<TEntity>> query, CancellationToken cancel = default);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task UpdateAsync<TDto>(TDto dto, Func<IQueryable<TEntity>, IQueryable<TEntity>> query, CancellationToken cancel = default);
|
||||
#endregion Update
|
||||
|
||||
#region Delete
|
||||
public Task DeleteAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancel = default);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task DeleteAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancel = default);
|
||||
|
||||
public Task DeleteAsync(Func<IQueryable<TEntity>, IQueryable<TEntity>> query, CancellationToken cancel = default);
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task DeleteAsync(Func<IQueryable<TEntity>, IQueryable<TEntity>> query, CancellationToken cancel = default);
|
||||
#endregion Delete
|
||||
|
||||
#region Obsolete
|
||||
[Obsolete("Use CreateAsync, UpdateAsync or DeleteAsync")]
|
||||
public IQueryable<TEntity> Read();
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
IQueryable<TEntity> Read();
|
||||
|
||||
[Obsolete("Use IRepository<TEntity>.Where")]
|
||||
public IQueryable<TEntity> ReadOnly();
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
IQueryable<TEntity> ReadOnly();
|
||||
#endregion
|
||||
}
|
||||
|
||||
public interface IRepository
|
||||
{
|
||||
public IRepository<TEntity> Entity<TEntity>() where TEntity : IEntity;
|
||||
IRepository<TEntity> Entity<TEntity>() where TEntity : IEntity;
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK
|
||||
}
|
||||
#endif
|
||||
Loading…
x
Reference in New Issue
Block a user