提交 8da756e9 编写于 作者: V vosen

Support for binary data.

上级 5aad5f40
......@@ -1522,6 +1522,8 @@ static List<FieldInfo> GetSettableFields(Type t)
{
if (!String.Equals(ctorParameters[i].Name, names[i], StringComparison.OrdinalIgnoreCase))
break;
if (types[i] == typeof(byte[]) && ctorParameters[i].ParameterType.FullName == LinqBinary)
continue;
var unboxedType = Nullable.GetUnderlyingType(ctorParameters[i].ParameterType) ?? ctorParameters[i].ParameterType;
if (unboxedType != types[i] && !(unboxedType.IsEnum && Enum.GetUnderlyingType(unboxedType) == types[i]))
break;
......
......@@ -60,6 +60,24 @@ public void TestNoDefaultConstructor()
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
public void TestAbstractInheritance()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册