I need to recover a single object from the database because I want to load some special options on that record but the most I get is to generate a list.
Would you have any chance of getting that record?
I need to recover a single object from the database because I want to load some special options on that record but the most I get is to generate a list.
Would you have any chance of getting that record?
You can use the DbSet<TEntity>.Find(params Object[] keyValues)
As a parameter you pass the Id (mapped to the primary key) of the object you want to obtain and it will return only this and not a list.
Example:
Persona p = Db.Personas.Find(23);
Or if the primary key is composed
Categoria q = Db.Categorias.Find(1, 4);