0

This is a migration project, I have a table in SQL Server containing image data stored as VARBINARY(MAX) data type, able to store image as byte[] to database using EF Core 8. While retrieving data from database using EF Core, I get an exception.

Database table schema:

enter image description here

DbSet model

enter image description here

Rows in the database, inserted using same EF Core DbContext:

enter image description here

But while retrieving collection of rows using the code shown here, it is throwing an exception

Data is Null. This method or property cannot be called on Null values

Code:

var dbContext = new MigrationDBContext();
var list = dbContext.ImageDetails.ToList();

I am trying storing image data with EF Core for the very first time, any suggestions?

2
  • 3
    File_Blob_Path and File_Local_Path should be of type string?. And do not post code as images. Commented Mar 14, 2024 at 5:01
  • thanks @SvyatoslavDanyliv, this really helped to solve the problem. Commented Mar 14, 2024 at 5:04

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.