SimpleRepositoryを何ヶ月も使用していますが、初めて画像/ドキュメントをアップロードしてデータベースに保存する必要があります
私のクラスは次のようになります。
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
}
データをデータベースに永続化するとき、subsonicは「DocumentData」を無視します
次に、ファイルをdbに保存するにはどうすればよいですか?
- DocumantData = File.ReadAllBytes( "somefile.doc")