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