Table of Contents

Interface IUnitRepository

Namespace
adas_core.Application.Repositories.Interfaces
Assembly
adas-core.Application.dll
public interface IUnitRepository : IMongoRepository<Unit>
Inherited Members
Extension Methods

Methods

CountUnitsByMasterListId(ObjectId, MasterListType)

Asynchronously counts the number of units associated with the master list identified by the specified identifier and type.

Task<long> CountUnitsByMasterListId(ObjectId id, MasterListType masterListType)

Parameters

id ObjectId

The unique identifier of the master list whose units should be counted.

masterListType MasterListType

The type of the master list used to resolve the appropriate unit collection.

Returns

Task<long>

A task that represents the asynchronous operation, containing the total number of units matching the specified master list.

FindById(object)

Asynchronously retrieves a Unit entity by its identifier.

Task<Unit?> FindById(object id)

Parameters

id object

The identifier of the Unit to locate.

Returns

Task<Unit>

A task that resolves to the matching Unit, or null if no entity is found.

FindByMasterListId(ObjectId)

Asynchronously retrieves the collection of Unit entities associated with the specified master list identifier.

Task<IEnumerable<Unit>> FindByMasterListId(ObjectId id)

Parameters

id ObjectId

The MongoDB.Bson.ObjectId of the master list whose units are being requested.

Returns

Task<IEnumerable<Unit>>

A task that represents the asynchronous operation. The task result contains an IEnumerable<T> with the units linked to the given master list.

FindByMasterListId(ObjectId, MasterListType)

Retrieves the collection of units associated with the specified master list identifier and master list type.

Task<IEnumerable<Unit>> FindByMasterListId(ObjectId id, MasterListType masterListType)

Parameters

id ObjectId

The unique identifier of the master list whose units should be retrieved.

masterListType MasterListType

The type of the master list used to filter or scope the unit lookup.

Returns

Task<IEnumerable<Unit>>

A task that represents the asynchronous operation, containing the collection of units linked to the specified master list.

FindByName(string)

Asynchronously finds a unit by its section name.

Task<Unit?> FindByName(string section)

Parameters

section string

The name of the section to search for.

Returns

Task<Unit>

A task that represents the asynchronous operation. The task result contains the unit if found; otherwise, null.

GetAll()

Asynchronously retrieves all available units and returns them as a list.

Task<List<Unit>> GetAll()

Returns

Task<List<Unit>>

A task that represents the asynchronous operation, containing a list of all Unit entities.

GetPaginatedUnits(PaginationFilter)

Retrieves a paginated collection of Unit records based on the provided pagination criteria.

IFindFluent<Unit, Unit> GetPaginatedUnits(PaginationFilter filter)

Parameters

filter PaginationFilter

The pagination filter that defines the page size, page number, and any additional filtering criteria.

Returns

IFindFluent<Unit, Unit>

An MongoDB.Driver.IFindFluent<TDocument, TProjection> representing the fluent query for the paginated units.

InsertOneUnit(Unit)

Inserts a single Unit record and returns the inserted entity, or null if the insertion did not produce a result.

Task<Unit?> InsertOneUnit(Unit unit)

Parameters

unit Unit

The Unit entity to insert.

Returns

Task<Unit>

A task that represents the asynchronous insert operation. The task result contains the inserted Unit, or null when no unit is returned.

UpdateConfiguration(ObjectId, UnitConfiguration)

Updates the configuration of a unit identified by the specified identifier.

Task<bool> UpdateConfiguration(ObjectId unitIdParsed, UnitConfiguration unitConfiguration)

Parameters

unitIdParsed ObjectId

The parsed object identifier of the unit whose configuration will be updated.

unitConfiguration UnitConfiguration

The new configuration values to apply to the unit.

Returns

Task<bool>

A task that represents the asynchronous operation. The task result is true if the configuration was successfully updated; otherwise, false.

UpdateUnit(Unit)

Updates an existing unit in the underlying store and returns the updated entity.

Task<Unit?> UpdateUnit(Unit section)

Parameters

section Unit

The unit containing the updated data to persist.

Returns

Task<Unit>

A task that resolves to the updated Unit, or null when the unit cannot be found.

UpdateUnitInfo(ObjectId, string, string)

Updates the name and title of an existing unit identified by the specified identifier.

Task<Unit?> UpdateUnitInfo(ObjectId unitId, string name, string title)

Parameters

unitId ObjectId

The unique identifier of the unit to update.

name string

The new name to assign to the unit.

title string

The new title to assign to the unit.

Returns

Task<Unit>

A task that represents the asynchronous update operation. The task result contains the updated Unit, or null if the unit was not found.

UpdateUnitMasterList(UpdateUnitIdListDto)

Updates the unit master list based on the provided unit identifiers. Returns the updated Unit when the operation succeeds, or null when no matching unit is found.

Task<Unit?> UpdateUnitMasterList(UpdateUnitIdListDto updateUnitListDto)

Parameters

updateUnitListDto UpdateUnitIdListDto

The data transfer object containing the list of unit identifiers to update.

Returns

Task<Unit>

A task that represents the asynchronous operation. The task result contains the updated Unit, or null if no unit was updated.