Store files in database using Entity Framework Core

后端 未结 3 2466
-上瘾入骨i
-上瘾入骨i 2021-02-19 22:45

How to store files in a SQL Server database using Entity Framework Core (Code-First) in an ASP.NET Core app?

I have tried using Filestream but unfortunately

3条回答
  •  萌比男神i
    2021-02-19 23:32

    You can convert the file bytes to a byte array.

    public byte[] Avatar { get; set; }
    

    Examine the accepted answer in the analogous approach for EF6: Save and retrieve image (binary) from SQL Server using Entity Framework 6

提交回复
热议问题