1

I want to store pdf file inside sql server 2008R2. ORM is nhibernate so my property is

public virtual byte[] PDFFile { get; set; }       

and it is mapped like

Property(x => x.PDFFile);  

inside database column is of type varbinary(MAX)

I think problem resides in the mapping of this property but I dont know how to overcome this.

On upload I'm getting

The length of the byte[] value exceeds the length configured in the mapping/parameter.

1 Answer 1

1

It is caused by nHibernate limiting the length of that column type to 8000.

You can get round this by changing your fluent mapping to this:

Map(x => x.PDFFile).CustomType("BinaryBlob").Length(100000);

Where you can set the length to be whatever works for you although typically it should be int.MaxValue or less.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.