diff --git a/Dapper/CustomPropertyTypeMap.cs b/Dapper/CustomPropertyTypeMap.cs index 0d36f7470..919e561df 100644 --- a/Dapper/CustomPropertyTypeMap.cs +++ b/Dapper/CustomPropertyTypeMap.cs @@ -9,14 +9,14 @@ namespace Dapper public sealed class CustomPropertyTypeMap : SqlMapper.ITypeMap { private readonly Type _type; - private readonly Func _propertySelector; + private readonly Func _propertySelector; /// /// Creates custom property mapping /// /// Target entity type /// Property selector based on target type and DataReader column name - public CustomPropertyTypeMap(Type type, Func propertySelector) + public CustomPropertyTypeMap(Type type, Func propertySelector) { _type = type ?? throw new ArgumentNullException(nameof(type)); _propertySelector = propertySelector ?? throw new ArgumentNullException(nameof(propertySelector)); diff --git a/Dapper/PublicAPI.Shipped.txt b/Dapper/PublicAPI.Shipped.txt index c1b08ea99..5428f0eca 100644 --- a/Dapper/PublicAPI.Shipped.txt +++ b/Dapper/PublicAPI.Shipped.txt @@ -22,7 +22,7 @@ Dapper.CommandFlags.NoCache = 4 -> Dapper.CommandFlags Dapper.CommandFlags.None = 0 -> Dapper.CommandFlags Dapper.CommandFlags.Pipelined = 2 -> Dapper.CommandFlags Dapper.CustomPropertyTypeMap -Dapper.CustomPropertyTypeMap.CustomPropertyTypeMap(System.Type! type, System.Func! propertySelector) -> void +Dapper.CustomPropertyTypeMap.CustomPropertyTypeMap(System.Type! type, System.Func! propertySelector) -> void Dapper.CustomPropertyTypeMap.FindConstructor(string![]! names, System.Type![]! types) -> System.Reflection.ConstructorInfo? Dapper.CustomPropertyTypeMap.FindExplicitConstructor() -> System.Reflection.ConstructorInfo? Dapper.CustomPropertyTypeMap.GetConstructorParameter(System.Reflection.ConstructorInfo! constructor, string! columnName) -> Dapper.SqlMapper.IMemberMap! diff --git a/tests/Dapper.Tests/TypeHandlerTests.cs b/tests/Dapper.Tests/TypeHandlerTests.cs index 2e754ca46..7dc41389a 100644 --- a/tests/Dapper.Tests/TypeHandlerTests.cs +++ b/tests/Dapper.Tests/TypeHandlerTests.cs @@ -59,7 +59,7 @@ public void TestChangingDefaultStringTypeMappingToAnsiStringFirstOrDefault() public void TestCustomTypeMap() { // default mapping - var item = connection.Query("Select 'AVal' as A, 'BVal' as B").Single(); + var item = connection.Query("Select 'AVal' as A, 'BVal' as B, 'CVal' as C").Single(); Assert.Equal("AVal", item.A); Assert.Equal("BVal", item.B); @@ -68,13 +68,13 @@ public void TestCustomTypeMap() (type, columnName) => type.GetProperties().FirstOrDefault(prop => GetDescriptionFromAttribute(prop) == columnName)!); SqlMapper.SetTypeMap(typeof(TypeWithMapping), map); - item = connection.Query("Select 'AVal' as A, 'BVal' as B").Single(); + item = connection.Query("Select 'AVal' as A, 'BVal' as B, 'CVal' as C").Single(); Assert.Equal("BVal", item.A); Assert.Equal("AVal", item.B); // reset to default SqlMapper.SetTypeMap(typeof(TypeWithMapping), null); - item = connection.Query("Select 'AVal' as A, 'BVal' as B").Single(); + item = connection.Query("Select 'AVal' as A, 'BVal' as B, 'CVal' as C").Single(); Assert.Equal("AVal", item.A); Assert.Equal("BVal", item.B); }