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);
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Infrastructure.Logging
|
||||
{
|
||||
_logger.LogWarning(message, args);
|
||||
}
|
||||
|
||||
public void LogInformation(string message, params object[] args)
|
||||
{
|
||||
_logger.LogInformation(message, args);
|
||||
|
||||
Reference in New Issue
Block a user