Se eu li isso corretamente, você está realmente tentando salvar o
byte[] para o banco de dados, que não pode funcionar, pois byte[] não é uma entidade mapeada. Você provavelmente quer escrever:
dl.Contents = new DownloadContent { Data = content };
db.session.SaveOrUpdate(dl); // content is wrong, since content is of type byte[]
Além disso, como você não especificou um
Inverse() , você provavelmente terá que SaveOrUpdate o DownloadContent primeiro, portanto:Download dl = new Download { OutFileName = "Test", DoForward = true };
DownloadContent dlc = new DownloadContent { Data = content };
dl.Contents = dlc;
db.session.SaveOrUpdate(dlc);
db.session.SaveOrUpdate(dl);