EntityFramework 5 (Model First) and SQLCE: what 'Type' property to store an image?

二次信任 提交于 2019-12-12 03:33:34

问题


Framework: In an asp.net MVC 4 project I'm using EntityFramework 5 for the first time and have chosen to use "Model First" due to the ease of model implementation (the ability to generate the db schema once the model is created using the designer). Also, I've chosen to use SQLCE opposed to SQLExpress based on the lightweight nature and requirements of the project.

Question: What is the best property Type selection in the .edmx designer for saving images in the compact sql database? I'm thinking I could convert the image to binary (as I've done in previous web forms projects) but there's no option for varbinary(max).


回答1:


EDIT You can define Property Type to "binary" and Map SqlType like "image"



来源:https://stackoverflow.com/questions/15329877/entityframework-5-model-first-and-sqlce-what-type-property-to-store-an-imag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!