提交 34371620 编写于 作者: M Marc Gravell

Merge branch 'BrannJoly-fix_SO27024806'

...@@ -5297,7 +5297,8 @@ public ConstructorInfo FindConstructor(string[] names, Type[] types) ...@@ -5297,7 +5297,8 @@ public ConstructorInfo FindConstructor(string[] names, Type[] types)
var unboxedType = Nullable.GetUnderlyingType(ctorParameters[i].ParameterType) ?? ctorParameters[i].ParameterType; var unboxedType = Nullable.GetUnderlyingType(ctorParameters[i].ParameterType) ?? ctorParameters[i].ParameterType;
if (unboxedType != types[i] if (unboxedType != types[i]
&& !(unboxedType.IsEnum && Enum.GetUnderlyingType(unboxedType) == types[i]) && !(unboxedType.IsEnum && Enum.GetUnderlyingType(unboxedType) == types[i])
&& !(unboxedType == typeof(char) && types[i] == typeof(string))) && !(unboxedType == typeof(char) && types[i] == typeof(string))
&& !(unboxedType.IsEnum && types[i] == typeof(string)))
break; break;
} }
......
...@@ -3526,6 +3526,25 @@ public void SO24740733_TestCustomValueHandler() ...@@ -3526,6 +3526,25 @@ public void SO24740733_TestCustomValueHandler()
foo.CategoryRating.Value.IsEqualTo(200); foo.CategoryRating.Value.IsEqualTo(200);
} }
enum SO27024806Enum { Foo, Bar }
private class SO27024806Class
{
public SO27024806Class(SO27024806Enum myField)
{
this.MyField = myField;
}
public SO27024806Enum MyField { get; set; }
}
public void SO27024806_TestVarcharEnumMemberWithExplicitConstructor()
{
var foo = connection.Query<SO27024806Class>("SELECT 'Foo' AS myField").Single();
foo.MyField.IsEqualTo(SO27024806Enum.Foo);
}
public void SO24740733_TestCustomValueSingleColumn() public void SO24740733_TestCustomValueSingleColumn()
{ {
Dapper.SqlMapper.AddTypeHandler(RatingValueHandler.Default); Dapper.SqlMapper.AddTypeHandler(RatingValueHandler.Default);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册