-
Notifications
You must be signed in to change notification settings - Fork 877
Stop using reflection to map built-in types #3507
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
Conversation
Just specify them explicitly - simpler and more linker-friendly. Part of npgsql#3300
YohDeadfall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird that 1074b91 was dropped and that I was requested. What happened?
| TypeHandlerFactory = new DefaultTypeHandlerFactory(typeof(CidrHandler)) | ||
| }.Build()); | ||
|
|
||
| var inetClrTypes = new List<Type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need a list here, arrays, arrays are more compact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReadOnlyIpAddress type is added just below when it's available.
This code gets executed exactly once at startup...
That was my fault - I accidentally got my repos/branches crossed and force-pushed to the wrong place :( Have pushed that commit again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
This is they way it should always have been!
|
My (stupid) past self apparently had some other ideas. |
I still see the point in those past ideas, but looking at it now it's about the same amount of code, with the difference that now the code flow is more obvious. |
|
I completely agree. This was triggered by wanting to make Npgsql more linker-friendly, but I really think this also makes it more human-friendly too. |
|
I wonder what you'll think of my next little project :) |
Just specify them explicitly - simpler and more linker-friendly.
Part of #3300
Note: there are various other opportunities to refactor the type mapping setup code and make it nicer, but am intentionally restricting this PR to getting rid of the reflection.