Value cannot be null. Parameter name: entitySet

前端 未结 12 1862
夕颜
夕颜 2020-12-03 17:02

I have a fairly standard setup with simply POCO classes

public class Project
{

    public int ProjectId { get; set; }
    public string Name { get; set; }
          


        
12条回答
  •  生来不讨喜
    2020-12-03 17:17

    I encountered this same issue and resolved like so:

    Error in model class:

    public class UserInformation
    {
        public string ID { get; set; }
        public string AccountUserName { get; set; }
        public HttpPostedFileBase ProfilePic { get; set; }
    }
    

    No error in model class

    public class UserInformation
    {
        public string ID { get; set; }
        public string AccountUserName { get; set; }
        public string ProfilePicName { get; set; }
    }
    

    My issue was resolved once i updated the ProfilePic property type from HttpPostedFileBase to string. If you have a property that is not of type string, int, double or some other basic/standard type either replace such property or update to a type which SQL is more likely to accept.

提交回复
热议问题