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

Typehandler support #117

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

samcragg
Copy link

Here's my initial attempt at solving #115

I've added a test case and manually verified the output, which looks like it's picked up the changes without effecting any other tests.

Let me know if you need me to make any changes and I can push them up - I've tried to avoid changing as much of the existing code as possible.

@samcragg
Copy link
Author

samcragg commented May 7, 2024

@mgravell Is there anything you need me to do with this PR - I'd love to get this feature in so I can start looking at the DateOnly/TimeOnly support next?

public override void PostProcess(in global::Dapper.UnifiedCommand cmd, global::Foo.CommandParameters args, int rowCount)
{
var ps = cmd.Parameters;
args.OutputValue = new global::CustomClassTypeHandler().Parse(ps[0]);
Copy link
Member

@mgravell mgravell Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this new concerns me; I would prefer something more like:

private static global::CustomClassTypeHandler? __handler42; // some generated pattern/index
private static global::CustomClassTypeHandler __Handler42 => __handler42 ??= new();
// ...
args.OutputValue = __Handler42.Parse(ps[0]);

@@ -10,7 +10,7 @@ namespace Dapper;
/// when processing values of type <typeparamref name="TValue"/>
/// </summary>
[ImmutableObject(true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module, AllowMultiple = true)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

presumably this is to keep the context simpler when emitting readers that may be shared/reused between targets?

@mgravell
Copy link
Member

mgravell commented Feb 7, 2025

I apologise for delay - 10 months! that's on me; life gets hectic; I've added some minor feedback, and given the delay is my fault, I'm happy to help deal with any fixup etc caused by delays. Overall approach looks sound.

@mgravell
Copy link
Member

mgravell commented Feb 7, 2025

Looks like DAP048 got take4n by something else

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

Successfully merging this pull request may close these issues.

2 participants