I'm trying to learn .Net Core MVC and I'm following a course where the following code gives a warning of a possible null reference return. Can some one tell me how to best handle this?
public async Task<T> GetByIdAsync(int id) { var result = await _context.Set<T>().FirstOrDefaultAsync(n => n.Id == id); return result; }
public async Task<T> GetByIdAsync(int id) { var result = await _context.Set<T>().FirstOrDefaultAsync(n => n.Id == id); return result; }