locked
SQLCE Image type and Entity Framework RRS feed

  • Question

  • I'm creating my first project with Entity Framework 5 and SQL Server Compact 4.0 and I'm using the "model First" method.  My database will include small images (< 50 KB each). SQL Compact supports an Image datatype, but EF does not.  After searching the forums, it appears that Binary is the correct type to use in EF, but the problem is that if I set the Max length of the field to 50,000 I get an error when I try to generate the database (saying that 8,000 is the maximum size supported). 

    Is there any way to use Entity Framework to model an entity that has an image (or a byte array of size 50,000) as a property?

    Monday, February 18, 2013 9:09 PM

Answers

  • Hi,

    Try perhaps http://adam-carter.com/posts/690 (image is replaced by varbinary(max) in SQL Server but my understanding is that SQL Server CE 4 is not yet aligned with that so meanwhile your best bet is likely to still use the image datatype).


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

    • Marked as answer by Blackwood Tuesday, February 19, 2013 3:44 PM
    Tuesday, February 19, 2013 3:24 PM