Binary Blob truncated to 8000 bytes - SQL Server 2008 / varbinary(max)

后端 未结 5 2100
你的背包
你的背包 2020-12-01 18:04

I have upgraded from Fluent Nhibernate 1.0 with Nhibernate 2.1 to pre- release 1.x with NHibernate 3.0 GA and have hit what I think is a regression, but I want to hear if th

5条回答
  •  误落风尘
    2020-12-01 18:53

    I too have encountered a similar problem and after much experimentation I noticed that when using Nhibernate to generate my schema to a file the generated column type was always length 8000.

    Setting setting CustomSqlType to Varbinary(max) as suggested above made no difference, however, this work around in my FluentMapping seemed to do the trick:

    Map(x => x.LogoBytes).CustomType("BinaryBlob").Length(1048576).Nullable();  
    

    The length of course is an arbitrary amount but I think it should be set to something less than int.Max. I am new to Nhibernate so I'm still figuring things out but I'd be interested to know if this helps you.

提交回复
热议问题