Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.8 kB
1
Indexable
Never
using JoelsFilmer.Common.DTOs;
using JoelsFilmer.Membership.Database.Entities;

namespace JoelsFilmer.Membership.Database.Services
{
    public interface IDbService
    {
        Task<List<TDto>> GetAsync<TEntity, TDto>()
        where TEntity : class, IEntity
        where TDto : class;

        Task<List<TDto>> GetAsync<TEntity, TDto>(Expression<Func<TEntity, bool>> expression)
        where TEntity : class, IEntity
        where TDto : class;

        Task<TDto> SingleAsync<TEntity, TDto>(
        Expression<Func<TEntity, bool>> expression)
            where TEntity : class, IEntity
            where TDto : class;

        Task<TEntity> AddAsync<TEntity, TDto>(TDto dto)
        where TEntity : class, IEntity
        where TDto : class;

        void Update<TEntity, TDto>(int id, TDto dto)
            where TEntity : class, IEntity
            where TDto : class;

        Task<bool> AnyAsync<TEntity>(Expression<Func<TEntity, bool>> expression)
            where TEntity : class, IEntity;

        Task<bool> DeleteAsync<TEntity>(int id)
            where TEntity : class, IEntity;

        Task<bool> SaveChangesAsync();

        string GetURI<TEntity>(TEntity entity) where TEntity : class, IEntity;
        void Include<TEntity>() where TEntity : class;

        bool Delete<TReferenceEntity, TDto>(TDto dto)
            where TReferenceEntity: class, IReferenceEntity
            where TDto : class;
        Task<List<TDto>> GetReferenceAsync<TReferenceEntity, TDto>()
        where TReferenceEntity : class, IReferenceEntity
        where TDto : class;

        Task<TReferenceEntity> AddReferenceAsync<TReferenceEntity, TDto>(TDto dto)
        where TReferenceEntity : class, IReferenceEntity
        where TDto : class;
    }
}