Segue código:
byte[] image1 = ConvertTo.Bytes(Request.Files[0]);
byte[] image2 = null;
ctx
.Users
.Where(x => x.Id == 1)
.Update(x => new User()
{
ImageByte1 = image1,
ImageByte2 = image2
});
Eu uso essa aqui: http://entityframework-plus.net/
Só da problema se eu definir null
na ImageByte2
. Segue erro:
A conversão implícita do tipo de dados nvarchar em varbinary(max) não é permitida. Use a função CONVERT para executar essa consulta
Agora seu eu definir ImageByte1
e ImageByte2
como null
, faz update normalmente ou ImageByte1
e ImageByte2
diferente de null
também faz update.
Alguma solução?
SqlBinary.Null
:/1.7.9