You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 24, 2026. It is now read-only.
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
The primary key will be detected from the database mappings. If you have multiple primary keys it will throw an exception.
The following methods are provided by DbRepositoryKey and their async counterparts:
GetByID()
Creates a query to pull an entity by the primary key. It will work with your primary key even if it's not called ID. I just used ID because is more concise.
GetByIDs()
Similar to GetByID but you can supplied an array of IDs and it will build a IN statement query to pull the entities
GetAllDictionary()
Return all entities in a dictionary with the primary key as the key of the dictionary.