Adding guards and more tests (#68)
* Adding single entity by spec method to repository * Adding guards and more unit tests
This commit is contained in:
@@ -26,6 +26,12 @@ namespace Infrastructure.Data
|
||||
return _dbContext.Set<T>().Find(id);
|
||||
}
|
||||
|
||||
public T GetSingleBySpec(ISpecification<T> spec)
|
||||
{
|
||||
return List(spec).FirstOrDefault();
|
||||
}
|
||||
|
||||
|
||||
public virtual async Task<T> GetByIdAsync(int id)
|
||||
{
|
||||
return await _dbContext.Set<T>().FindAsync(id);
|
||||
|
||||
Reference in New Issue
Block a user