|
From: <fab...@us...> - 2009-10-15 15:55:38
|
Revision: 4756
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4756&view=rev
Author: fabiomaulo
Date: 2009-10-15 15:55:27 +0000 (Thu, 15 Oct 2009)
Log Message:
-----------
Fix NH-1963
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Engine/TypedValue.cs
trunk/nhibernate/src/NHibernate.Test/EngineTest/TypedValueFixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1963/CacheableQueryOnByteArray.cs
Modified: trunk/nhibernate/src/NHibernate/Engine/TypedValue.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Engine/TypedValue.cs 2009-10-15 12:53:45 UTC (rev 4755)
+++ trunk/nhibernate/src/NHibernate/Engine/TypedValue.cs 2009-10-15 15:55:27 UTC (rev 4756)
@@ -22,7 +22,7 @@
this.type = type;
this.value = value;
ICollection values = value as ICollection;
- if (!type.IsCollectionType && values != null)
+ if (!type.IsCollectionType && values != null && !type.ReturnedClass.IsArray)
comparer = new ParameterListComparer(entityMode);
else
comparer = new DefaultComparer(entityMode);
@@ -38,6 +38,11 @@
get { return type; }
}
+ public IEqualityComparer<TypedValue> Comparer
+ {
+ get { return comparer; }
+ }
+
public override int GetHashCode()
{
return comparer.GetHashCode(this);
@@ -54,7 +59,7 @@
}
[Serializable]
- private class ParameterListComparer : IEqualityComparer<TypedValue>
+ public class ParameterListComparer : IEqualityComparer<TypedValue>
{
private readonly EntityMode entityMode;
@@ -118,7 +123,7 @@
}
[Serializable]
- private class DefaultComparer : IEqualityComparer<TypedValue>
+ public class DefaultComparer : IEqualityComparer<TypedValue>
{
private readonly EntityMode entityMode;
Modified: trunk/nhibernate/src/NHibernate.Test/EngineTest/TypedValueFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/EngineTest/TypedValueFixture.cs 2009-10-15 12:53:45 UTC (rev 4755)
+++ trunk/nhibernate/src/NHibernate.Test/EngineTest/TypedValueFixture.cs 2009-10-15 15:55:27 UTC (rev 4756)
@@ -27,5 +27,16 @@
{
Assert.AreEqual("null", new TypedValue(NHibernateUtil.Int32, null, EntityMode.Poco).ToString());
}
+
+ [Test]
+ public void WhenTheTypeIsAnArray_ChoseTheDefaultComparer()
+ {
+ byte[] value = new byte[]{1,2,3};
+
+
+ var tv = new TypedValue(NHibernateUtil.BinaryBlob, value, EntityMode.Poco);
+
+ Assert.That(tv.Comparer, Is.TypeOf<TypedValue.DefaultComparer>());
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1963/CacheableQueryOnByteArray.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1963/CacheableQueryOnByteArray.cs 2009-10-15 12:53:45 UTC (rev 4755)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1963/CacheableQueryOnByteArray.cs 2009-10-15 15:55:27 UTC (rev 4756)
@@ -39,7 +39,7 @@
return dialect as MsSql2000Dialect != null;
}
- [Test,Ignore]
+ [Test]
public void Should_be_able_to_do_cacheable_query_on_byte_array_field()
{
using (ISession session = this.OpenSession())
@@ -47,7 +47,7 @@
var data = new byte[] { 1, 2, 3 };
var result = session.CreateQuery("from DomainClass d where d.ByteData = :data")
- .SetParameter("data", data)
+ .SetBinary("data", data)
.SetCacheable(true)
.UniqueResult<DomainClass>();
@@ -59,7 +59,7 @@
var data = new byte[] { 1, 2, 3 };
var result = session.CreateQuery("from DomainClass d where d.ByteData = :data")
- .SetParameter("data", data)
+ .SetBinary("data", data)
.SetCacheable(true)
.UniqueResult<DomainClass>();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|