There is currently an issue in saving a binaryblob to sql server ce as SqlDbType.Image. It throws the following error:
Byte array truncation to a length of 8000.
To solve this do the following:
1. Create a new driver class as shown below and override the InitializeParamenter method.
public class YourSqlServerCeDriver : SqlServerCeDriver
{
protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType)
{
base.InitializeParameter(dbParam, name, sqlType);
if (sqlType is BinarySqlType)
{
PropertyInfo dbParamSqlDbTypeProperty = dbParam.GetType().GetProperty("SqlDbType");
dbParamSqlDbTypeProperty.SetValue(dbParam, SqlDbType.Image, null);
}
}
}
2. Use this Driver type as YourSqlServerCeDriver instead of the default SqlServerCeDriver in the NHibernate Configuration.
Reference:http://www.mail-archive.com/nhusers@googlegroups.com/msg00688.html
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment