I have code first model that looks like this:
public class Document
{
[Key]
public int DocumentId {get;set;}
[Required]
public byte[] Blob {get; set;}
}
I want that to map to blob data type in MySQL but I keep getting varbinary(255)
How do I get it to map to "blob"?
I used Pomelo.EntityFrameworkCore.MySql to fix my problem.
In your OnModelCreating do:
modelBuilder.Entity<Document>(entity =>
{
entity.Property(x => x.Blob ).HasColumnType("blob");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With