I already create a table contain blob field and transfer the file into byte array.
But it will get error when execute the code blow to insert data into the table.
Table table = new Table();
table.FileName = FileName;
table.Content = Convert.FromBase64String(input_file);
db.Table.Add(table);
db.SaveChanges();
The error message is "ora-01460 unimplemented or unreasonable conversion requested".
I tried to insert the same data by oracle executeNonQuery instead Linq and it would work.
But I wonder why it will get error when using Linq.
Here is the Table class content:
public class Table
{
public string FileName { get; set; }
public byte[] Content { get; set; }
}
Here are the assembly I using:
Microsoft.EntityFrameworkCore 3.1.6
Oracle.EntityFrameworkCore v3.19.0-beta2
Oracle.ManagedDataAccess.Core v2.19.80
Table DDL:
CREATE TABLE "TABLE"
(
"FILENAME" VARCHAR2(100 BYTE),
"FILECONTENT" BLOB
)
It would work after I add Column Type and MaxLength as below:
public class Table
{
public string FileName { get; set; }
[Column("Content", TypeName = "BLOB")]
[MaxLength(2147483647)]
public byte[] Content { get; set; }
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.