Subsonic SimpleRepository upload image
Posted
by Dusty Roberts
on Stack Overflow
See other posts from Stack Overflow
or by Dusty Roberts
Published on 2010-03-10T14:06:33Z
Indexed on
2010/03/12
8:17 UTC
Read the original article
Hit count: 434
Hi There
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
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"
how do i save the file to db then?
- DocumantData = File.ReadAllBytes("somefile.doc")
© Stack Overflow or respective owner