Reputation: 1574
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"?
Upvotes: 7
Views: 9200
Reputation: 1029
In your OnModelCreating do:
modelBuilder.Entity<Document>(entity =>
{
entity.Property(x => x.Blob ).HasColumnType("blob");
}
Upvotes: 4