Resolve all warnings
This commit is contained in:
@@ -16,8 +16,8 @@ namespace GerbilManagerWebAPI.DAL
|
||||
}
|
||||
|
||||
public virtual IEnumerable<TEntity> Get(
|
||||
Expression<Func<TEntity, bool>> filter = null,
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
|
||||
Expression<Func<TEntity, bool>> filter = null!,
|
||||
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null!,
|
||||
string includeProperties = "")
|
||||
{
|
||||
IQueryable<TEntity> query = dbSet;
|
||||
@@ -45,7 +45,7 @@ namespace GerbilManagerWebAPI.DAL
|
||||
|
||||
public virtual TEntity GetByID(object id)
|
||||
{
|
||||
return dbSet.Find(id);
|
||||
return dbSet?.Find(id)!;
|
||||
}
|
||||
|
||||
public virtual void Insert(TEntity entity)
|
||||
@@ -55,8 +55,8 @@ namespace GerbilManagerWebAPI.DAL
|
||||
|
||||
public virtual void Delete(object id)
|
||||
{
|
||||
TEntity entityToDelete = dbSet.Find(id);
|
||||
Delete(entityToDelete);
|
||||
TEntity entityToDelete = dbSet?.Find(id)!;
|
||||
if (entityToDelete is not null) Delete(entityToDelete);
|
||||
}
|
||||
|
||||
public virtual void Delete(TEntity entityToDelete)
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace GerbilManagerWebAPI.DAL
|
||||
public class UnitOfWork : IDisposable
|
||||
{
|
||||
private ApplicationContext context;
|
||||
private GenericRepository<Gerbil> gerbilRepository;
|
||||
private GenericRepository<Litter> litterRepository;
|
||||
private GenericRepository<Breeder> breederRepository;
|
||||
private GenericRepository<Gerbil> gerbilRepository = null!;
|
||||
private GenericRepository<Litter> litterRepository = null!;
|
||||
private GenericRepository<Breeder> breederRepository = null!;
|
||||
|
||||
public GenericRepository<Gerbil> GerbilRepository
|
||||
{
|
||||
@@ -46,10 +46,7 @@ namespace GerbilManagerWebAPI.DAL
|
||||
}
|
||||
}
|
||||
|
||||
public UnitOfWork(ApplicationContext context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
public UnitOfWork(ApplicationContext context) => this.context = context;
|
||||
|
||||
public void Save()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user