简体   繁体   English

Subsonic SimpleRepository上传图像

[英]Subsonic SimpleRepository upload image

I have been using SimpleRepository for months now, and for the first time i have to upload and store an Image/Document in the database 我已经使用SimpleRepository已有几个月了,并且第一次我必须在数据库中上载和存储图像/文档。

My Class looks as follow: 我的班级如下:

public class Document: ObjectMetaData
{
    public string FileName { get; set; }
    public Guid UserId { get; set; }
    public DocumentType DocumentType { get; set; }
    public string DocumentLocation { get; set; }
    public byte[] DocumentData { get; set; }
}

public enum DocumentType
{
    EmploymentContractSigned = 1,
    EmploymentContractUnSigned = 2
}

When i persist the data to the db, subsonic just ignore's the "DocumentData" 当我将数据持久保存到数据库时,subsonic只是忽略了“ DocumentData”

how do i save the file to db then? 我如何将文件保存到数据库呢?

  • DocumantData = File.ReadAllBytes("somefile.doc") DocumantData = File.ReadAllBytes(“ somefile.doc”)

在github上找到了答案,他们在以后的版本中解决了这个问题: http : //github.com/inbox/555338#reply

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM