Commit 76b930a4 authored by Sam Saffron's avatar Sam Saffron

fix regression with Guid mapping

parent 86ea6f60
......@@ -926,11 +926,7 @@ private static CacheInfo GetCacheInfo(Identity identity)
}
#endif
if (
(type.IsClass && type != typeof(string) && type != typeof(byte[]) && type != typeof(System.Data.Linq.Binary)) ||
(type.IsValueType && !type.IsPrimitive && !(type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
&& type != typeof(Guid))
)
if (!typeMap.ContainsKey(type))
{
return GetTypeDeserializer(type, reader, startBound, length, returnNullIfFirstMissing);
}
......
......@@ -16,6 +16,24 @@ class Tests
{
SqlConnection connection = Program.GetOpenConnection();
public void TestNullableGuidSupport()
{
var guid = connection.Query<Guid?>("select null").First();
guid.IsNull();
guid = Guid.NewGuid();
var guid2 = connection.Query<Guid?>("select @guid", new { guid }).First();
guid.IsEqualTo(guid2);
}
public void TestNonNullableGuidSupport()
{
var guid = Guid.NewGuid();
var guid2 = connection.Query<Guid?>("select @guid", new { guid }).First();
Assert.IsTrue(guid == guid2);
}
struct Car
{
public enum TrapEnum : int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment