Commit 8da756e9 authored by vosen's avatar vosen

Support for binary data.

parent 5aad5f40
...@@ -1522,6 +1522,8 @@ static List<FieldInfo> GetSettableFields(Type t) ...@@ -1522,6 +1522,8 @@ static List<FieldInfo> GetSettableFields(Type t)
{ {
if (!String.Equals(ctorParameters[i].Name, names[i], StringComparison.OrdinalIgnoreCase)) if (!String.Equals(ctorParameters[i].Name, names[i], StringComparison.OrdinalIgnoreCase))
break; break;
if (types[i] == typeof(byte[]) && ctorParameters[i].ParameterType.FullName == LinqBinary)
continue;
var unboxedType = Nullable.GetUnderlyingType(ctorParameters[i].ParameterType) ?? ctorParameters[i].ParameterType; var unboxedType = Nullable.GetUnderlyingType(ctorParameters[i].ParameterType) ?? ctorParameters[i].ParameterType;
if (unboxedType != types[i] && !(unboxedType.IsEnum && Enum.GetUnderlyingType(unboxedType) == types[i])) if (unboxedType != types[i] && !(unboxedType.IsEnum && Enum.GetUnderlyingType(unboxedType) == types[i]))
break; break;
......
...@@ -60,6 +60,24 @@ public void TestNoDefaultConstructor() ...@@ -60,6 +60,24 @@ public void TestNoDefaultConstructor()
nodef.N.IsEqualTo(null); nodef.N.IsEqualTo(null);
} }
class NoDefaultConstructorWithBinary
{
public System.Data.Linq.Binary Value { get; set; }
public NoDefaultConstructorWithBinary(System.Data.Linq.Binary value)
{
Value = value;
}
}
public void TestNoDefaultConstructorBinary()
{
byte[] orig = new byte[20];
new Random(123456).NextBytes(orig);
var input = new System.Data.Linq.Binary(orig);
var output = connection.Query<NoDefaultConstructorWithBinary>("select @input as [value]", new { input }).First().Value;
output.ToArray().IsSequenceEqualTo(orig);
}
// http://stackoverflow.com/q/8593871 // http://stackoverflow.com/q/8593871
public void TestAbstractInheritance() public void TestAbstractInheritance()
{ {
......
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