subsonic 3 - Object of type 'System.Byte[]' cannot be converted to type 'System.String'

时间秒杀一切 提交于 2019-12-13 03:55:03

问题


I have this piece of code that works fine in subsonic 2.2, I migrated to subsonic 3 but now i get this error 'Object of type 'System.Byte[]' cannot be converted to type 'System.String'.' subsonic 2.2 code in comment

public IList<Tag> Tags
{
    get
    {
        return Tag.Find(t => t.TypeId == 1 && t.ItemID == JobId).ToList();
        // new TagCollection().Where(Tag.Columns.TypeId, 1)
        // .Where(Tag.Columns.ItemID, JobId).Load();
    }
}

Where TypeId and ItemId are int how can this be fixed ?


回答1:


Are you using the latest version (3.0.0.1), what you're reporting looks very similar to:

Subsonic 3: Invalid cast from 'System.Byte' to 'System.Byte[]'

Also which database are you using?




回答2:


i'm using 3.0.0.0

the error is similar

in SQLServer.ttinclude, missing sql type "timestamp"

where you see

string GetSysType(string sqlType){
...

case "image":
case "binary":
case "varbinary":
     sysType= "byte[]";
     break;
...
}

change to string GetSysType(string sqlType){ ...

case "image":
case "binary":
case "varbinary":
case "timestamp":
     sysType= "byte[]";
     break;
...
}



回答3:


i have run into same issue however needed to add the following case to MySQL.ttinclude template:

        case "image":
    case "binary":
    case "varbinary":
--> case "longblob": <--
        sysType=  "byte[]";
         break;


来源:https://stackoverflow.com/questions/1101811/subsonic-3-object-of-type-system-byte-cannot-be-converted-to-type-system

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