Reputation: 4459
i've recently added a new property to one of my models:
public HttpPostedFile AvailabilityImage { get; set; }
However, upon doing so I'm now getting this very strange error:
error 3004: Problem in mapping fragments starting at line 32:No mapping specified for properties FloorModel.AvailabilityImage in Set Floor
I am at a loss on how to solve this, I've never had this issue adding properties before?
Is it to do with the Data type being used with this property do you think? Any suggestions are welcome
Thankyou
Upvotes: 0
Views: 419
Reputation: 51
The framework could of auto-generated a new DbSet with a complex data type. It has happened to me when I'm building models and passing DbSet data types under the model constructor. Go verify the model and remove any complex data types and comment out any DbSet related to that model.
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
.
.
.
public System.Data.Entity.DbSet<Solution.Models.Model1> Model1 { get; set; }
//Comment out possible Model and try debugging again.
//public System.Data.Entity.DbSet<Solution.Models.Model2> Model2 { get; set; }
}
Upvotes: 0
Reputation: 93444
HttpPostedFile is a complex type and contains many aspects to it that cannot be properly serialized. For example, it contains a property that references the current HttpResponseStream. This will be different every time you make a connection, so you can't serialize this.
I doubt what you are trying to do is correct anyways. Are you trying to save the file that is uploaded? If so, then you need to save the actual binary contents.. not the HttpPostedFile.
Upvotes: 1