See code below:
This is the error I'm receiving:
Error fetching data from Config table|Object reference not set to an instance of an object.
Any help would be much appreciated!
C#:
public ActionResult<List<string>> FetchConfig([FromBody] FetchConfigDto fetchConfigDto)
{
List<string> myResult = new List<string>();
_logger.Debug("getting config from database");
try
{
myResult = _context.config.Where(x => x.SwitchID == fetchConfigDto.SwitchID && x.AgentId == fetchConfigDto.AgentId).Select(x => x.ConfigFile).ToList();
}
catch (Exception ex)
{
_logger.Error(ex, "Error fetching data from Config table");
}
return myResult;
}
This is the error I'm receiving:
Error fetching data from Config table|Object reference not set to an instance of an object.
Any help would be much appreciated!