We have the following table:
With the following c# model
public record PSSEGMENTPICTURE
{
public int PSID { get; init; }
public int PSEDISEGMENTID { get; init; }
public byte[] PSIMAGE { get; init; }
}
Executing the following query I get the following results
public JsonResult GetSegmentPictures()
{
return _sql.ExecuteQuery(@"SELECT * FROM PSSEGMENTPICTURES");
}
The response
[
{
"PSID": 1,
"PSEDISEGMENTID": 1,
"PSIMAGE": null,
"created_at": "2021-10-29T12:48:59"
},
{
"PSID": 2,
"PSEDISEGMENTID": 2,
"PSIMAGE": null,
"created_at": "2021-10-29T12:49:00"
},
{
"PSID": 3,
"PSEDISEGMENTID": 3,
"PSIMAGE": null,
"created_at": "2021-10-29T12:49:01"
},
{
"PSID": 4,
"PSEDISEGMENTID": 4,
"PSIMAGE": null,
"created_at": "2021-10-29T12:49:02"
},
{
"PSID": 5,
"PSEDISEGMENTID": 5,
"PSIMAGE": null,
"created_at": "2021-10-29T12:49:02"
},
{
"PSID": 6,
"PSEDISEGMENTID": 6,
"PSIMAGE": null,
"created_at": "2021-10-29T12:49:03"
},
{
"PSID": 7,
"PSEDISEGMENTID": 7,
"PSIMAGE": null,
"created_at": "2021-10-29T12:49:05"
}]
What am I doing wrong? Ofcourse all the entries have blob values in the PSIMAGE column. Looking on the web I found that the type corresponding to blob is byte[] but this should not be the issue in this case since i'm returning the query result straight to json without mapping it to the model.