My Code-First entity column is declared like this:
[Required, DataType("image")]
public byte[] Picture { get; set; }
Validations are turned off:
Configuration.ValidateOnSaveEnabled = false;
And is column type is still varbinary(4000)
.
When I try to save data, Entity Framework throws an exception:
Byte array truncation to a length of 4000.
How to declare that C# byte[]
type should be mapped to image
SQL type?
Versions:
SQL Server Compact 4
Entity Framework 5 RC
.NET Framework 4.0
Use this attribute:
[MaxLength]