Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomPropertyTypeMap propertySelector does now allow null #2011

Open
uitmaurik opened this issue Dec 8, 2023 · 0 comments
Open

CustomPropertyTypeMap propertySelector does now allow null #2011

uitmaurik opened this issue Dec 8, 2023 · 0 comments

Comments

@uitmaurik
Copy link

uitmaurik commented Dec 8, 2023

The constructor of CustomPropertyTypeMap accepts two parameters. The propertySelector parameter is of type Func<Type, string, PropertyInfo>. If I understand correctly this means that the function must always return a PropertyInfo. Returning null is not allowed due to the project setting enable.
As the method public SqlMapper.IMemberMap? GetMember(string columnName) is the only method that uses the propertySelector and is already capable of handling a null return value, I would like to request to modify the constructor to (so changing the return type of the function from PropertyInfo to PropertyInfo?):

public CustomPropertyTypeMap(Type type, Func<Type, string, PropertyInfo?> propertySelector)

and of course the variable to:

private readonly Func<Type, string, PropertyInfo?> _propertySelector;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant