Write file to database with NHibernate

2

Is it possible to serialize and write database files with NHibernate?

public virtual File Arquivo { get; set; }

It does not let you map and did not want to write without using NHibernate to follow the pattern

    
asked by anonymous 06.12.2016 / 13:41

1 answer

3

Yes, it is possible. In C # the type will have to be byte[] and not File .

Because File is a static class, you will never be able to use an instance of File .

In mapping would stay:

Property(x => x.Arquivo, map =>
{
    map.Type(NHibernateUtil.BinaryBlob);
    map.Length(Int32.MaxValue);
});
    
06.12.2016 / 13:59