// ***********************************************************************
// Assembly : FCS.Lib
// Author : FH
// Created : 03-10-2015
//
// Last Modified By : FH
// Last Modified On : 2021-02-24
// ***********************************************************************
//
// Copyright © FCS 2015-2022
//
//
// ***********************************************************************
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace FCS.Lib
{
///
/// Interface IRepositoryEx
///
/// The type of the t entity
public interface IRepositoryEx where TEntity : class
{
///
/// Get all entities asynchronous
///
/// Predicate
/// Task<System.Boolean>
Task AllAsync(Expression> predicate);
///
/// Get all entities synchronous
///
/// Predicate
/// Task<System.Boolean>
Task AnyAsync(Expression> predicate);
///
/// Find matching entity asynchronous
///
/// Predicate
/// Task<TEntity>
Task FindAsync(Expression> predicate);
///
/// Find first matching entity asynchronous
///
/// Predicate
/// Task<TEntity>
Task FirstAsync(Expression> predicate);
///
/// Get first entity matching query or default entity asynchronous
///
/// Predicate
/// Task<TEntity>
Task FirstOrDefaultAsync(Expression> predicate);
///
/// Add an entity
///
/// The entity.
void Add(TEntity entity);
///
/// Attach the entity
///
/// The entity.
void Attach(TEntity entity);
///
/// Delete the entity
///
/// The entity.
void Delete(TEntity entity);
///
/// Anies the specified predicate.
///
/// The predicate.
/// true if XXXX, false otherwise.
bool Any(Expression> predicate);
///
/// Get all entities
///
/// IQueryable<TEntity>
IQueryable All();
///
/// Find all matching entities matching query
///
/// Predicate
/// IQueryable<TEntity>
IQueryable Find(Expression> predicate);
///
/// Find first entity matching query
///
/// Predicate
/// TEntity
TEntity First(Expression> predicate);
///
/// Find first matching entity or default entity
///
/// Predicate
/// TEntity
TEntity FirstOrDefault(Expression> predicate);
///
/// Get entity by id
///
/// The identifier.
/// TEntity
TEntity GetById(string id);
}
}