using System.Linq.Expressions; using adas_core.Domain.Models.Filter; using Microsoft.EntityFrameworkCore; namespace adas_core.Domain; public interface IDefaultRepository where T : class { /// /// Returns the for entity type , enabling querying and persistence operations against the corresponding table. /// /// A instance for the entity type . DbSet GetSet(); /// /// Gets an representing the queryable source of items, allowing callers to compose additional query operations. /// /// An that can be used to build and execute queries against the underlying data source. IQueryable Query(); /// /// Returns a queryable collection of items, optionally applying the specified pagination filter to control paging behavior. /// /// The pagination filter that controls paging of the returned items, or null to omit pagination. /// An that can be used to enumerate the items with the applied filter. IQueryable Query(PaginationFilter? filter); /// /// Returns a paginated queryable sequence of items based on the specified page and page size. /// /// The current page number; when null, pagination may be ignored or handled accordingly. /// The number of items per page; when null, a default page size may be used. /// An representing the requested page of items. IQueryable Query(int? currentPage, int? pageSize = null); /// /// Retrieves an entity of type by its identifier, optionally eager-loading related entities via the provided include expressions. /// /// The identifier of the entity to look up. /// Expressions that specify related entities to include in the returned result. /// The entity matching the supplied identifier, or null if no entity is found. T? GetById(TS id, params Expression>[] includeExpressions); /// /// Retrieves an entity of type by its identifier, returning null when no matching record is found. /// The lookup is performed using the provided to allow caller-specific query adjustments such as includes, filters, or tracking settings. /// /// The identifier of type used to locate the entity. /// A customizer that controls how the underlying query is constructed and executed. /// The matching entity of type , or null if no entity with the given is found. T? GetById(TS id, QueryCustomizer queryCustomizer); /*[Obsolete("Use GetById( id) instead")] T? GetById(int id); [Obsolete("Use GetById( id) instead")] T? GetById(long id); //T? GetById(string id);*/ /// /// Retrieves an entity of type by its composite key values, returning null if no matching entity is found. /// /// The values that compose the primary key of the entity to retrieve. /// The matching entity of type , or null if no entity is found. T? GetByIds(params object[] keyValues); /// /// Creates a new instance of type T based on the specified source object. /// /// The source object used to create the new instance. /// A new instance of type T created from the specified object. T Create(T obj); /// /// Creates a list of objects based on the provided collection of input items. /// /// The list of input objects to be created. /// A list of created objects of type . List Create(List objs); /// /// Deletes the specified object from the underlying data source and returns the result. /// /// The object of type to be deleted. /// The object of type representing the result of the delete operation. T Delete(T obj); /// /// Deletes the specified collection of objects. /// /// The collection of objects to delete. /// A list of the deleted objects. List Delete(ICollection objs); /// /// Deletes all records or entries managed by the associated repository or service. /// void DeleteAll(); /// /// Updates the specified entity in the underlying store and returns the updated instance. /// /// The entity instance containing the updated values to persist. /// The updated entity of type as returned by the operation. T Update(T obj); /// /// Gets the total number of items in the collection. /// /// The total count of items. int Count(); /// /// Returns the number of items that match the specified status. /// /// The status value used to filter the items being counted. /// The total count of items matching the specified status. int Count(string status); /// /// Retrieves all entities of type and returns them as a list. /// /// A containing all entities of type ; an empty list if none are found. List FindAll(); }