Skip to content

Using DbRepositoryKey

StrutTower edited this page Jul 4, 2024 · 7 revisions

DbRepositoryKey is a new class that extends DbRepository. It is used for repositories that map to a table with a single primary key and provides extra built-in methods around the primary key.

Initialization is very similar to DbRepository except you have to provide the type for the primary key. The example shows this as int

public class PersonRepository : DbRepositoryKey<Person, int> {
    
    public PersonRepository(UnitOfWork uow) : base(uow.DbRepository) { }
} 

The following methods are provided by DbRepositoryKey:

GetByID()

GetByIDs() GetAllDictionary()

Clone this wiki locally