mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#18641: Fixing SqlCe limit for binary data
Work Item: 18641 --HG-- branch : 1.x
This commit is contained in:
@@ -17,7 +17,7 @@ namespace Orchard.Tests.Data {
|
||||
ProviderUtilities.RunWithSqlCe(recordDescriptors,
|
||||
sessionFactory => {
|
||||
var session = sessionFactory.OpenSession();
|
||||
var foo = new BigRecord { Body = new String('x', 10000) };
|
||||
var foo = new BigRecord { Body = new String('x', 10000), Banner = new byte[10000]};
|
||||
session.Save(foo);
|
||||
session.Flush();
|
||||
session.Close();
|
||||
@@ -28,6 +28,7 @@ namespace Orchard.Tests.Data {
|
||||
|
||||
Assert.That(foo, Is.Not.Null);
|
||||
Assert.That(foo.Body, Is.EqualTo(new String('x', 10000)));
|
||||
Assert.That(foo.Banner.Length, Is.EqualTo(10000));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ namespace Orchard.Tests.Data {
|
||||
ProviderUtilities.RunWithSqlServer(recordDescriptors,
|
||||
sessionFactory => {
|
||||
var session = sessionFactory.OpenSession();
|
||||
var foo = new BigRecord { Body = new String('x', 10000) };
|
||||
var foo = new BigRecord { Body = new String('x', 10000), Banner = new byte[10000] };
|
||||
session.Save(foo);
|
||||
session.Flush();
|
||||
session.Close();
|
||||
@@ -53,6 +54,7 @@ namespace Orchard.Tests.Data {
|
||||
|
||||
Assert.That(foo, Is.Not.Null);
|
||||
Assert.That(foo.Body, Is.EqualTo(new String('x', 10000)));
|
||||
Assert.That(foo.Banner.Length, Is.EqualTo(10000));
|
||||
|
||||
});
|
||||
}
|
||||
|
@@ -5,5 +5,8 @@ namespace Orchard.Tests.Records {
|
||||
public virtual int Id { get; set; }
|
||||
[StringLengthMax]
|
||||
public virtual string Body { get; set; }
|
||||
|
||||
[StringLengthMax]
|
||||
public virtual byte[] Banner { get; set; }
|
||||
}
|
||||
}
|
@@ -83,6 +83,12 @@ namespace Orchard.Data.Providers {
|
||||
|
||||
protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType) {
|
||||
base.InitializeParameter(dbParam, name, sqlType);
|
||||
|
||||
if(sqlType.DbType == DbType.Binary) {
|
||||
_dbParamSqlDbTypeProperty.SetValue(dbParam, SqlDbType.Image, null);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sqlType.Length <= 4000 ) {
|
||||
return;
|
||||
}
|
||||
@@ -94,9 +100,6 @@ namespace Orchard.Data.Providers {
|
||||
case DbType.AnsiString:
|
||||
_dbParamSqlDbTypeProperty.SetValue(dbParam, SqlDbType.Text, null);
|
||||
break;
|
||||
case DbType.Byte:
|
||||
_dbParamSqlDbTypeProperty.SetValue(dbParam, SqlDbType.Image, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user