Error storing Image in SQL CE 4.0 with ASP.NET MVC 3 and Entity Framework 4.1 Code First

后端 未结 3 1040
难免孤独
难免孤独 2020-12-17 10:02

I\'m trying to store/save an image in an SQL Compact Edition (CE) database.

I declare the field in my Student model as:

[Column(TypeName = \"image\")         


        
3条回答
  •  被撕碎了的回忆
    2020-12-17 10:30

    I know this is too late, but it could benefit other programmers.

    You could add to the context class inside the OnModelCreating(DbModelBuilder modelBuilder) method

     modelBuilder.Entity().Property(p => p.Photo).IsMaxLength();
    

提交回复
热议问题