I am testing out the EF 4. and taking advantage of the Model first approach. Let me store images in to the database and I am unsure of the greatest type for that scalar within the entity.
I presently get it(the look scalar type) setup like a binary. From what I've been reading through the easiest method to keep image within the db is really a byte[]. So I am presuming that binary is what you want. If there's an easy method I'd switch.

alt text

During my controller I've:

 //file from client to store in the db
 HttpPostedFileBase file = Request.Files[inputTagName];
 if (file.ContentLength > 0)
   keyToAdd.Image = new byte[file.ContentLength];
   file.InputStream.Write(keyToAdd.Image, 0, file.ContentLength);

This develops fine however when I run it I recieve the best writing the stream to keyToAdd.Image. The exception is one thing like: Method doesn't exist.

Any ideas? Observe that when utilizing a EF 4. model first approach I have only int16, int32, double, string, decimal, binary, byte, DateTime, Double, Single, and SByte as available types. Thanks

Rather than using Write I ought to have used Read. I am still interested if there's an easy method to keep the look stream.

It had been file.InputStream.Write(tmpBytes, , file.ContentLength)

 byte[] tmpBytes = new byte[file.ContentLength];
 file.InputStream.Read(tmpBytes, 0, file.ContentLength);
 keyToAdd.Image = tmpBytes;