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

Using F# Record types as named parameters #10

Open
TheAngryByrd opened this issue Oct 6, 2017 · 1 comment
Open

Using F# Record types as named parameters #10

TheAngryByrd opened this issue Oct 6, 2017 · 1 comment

Comments

@TheAngryByrd
Copy link
Owner

As of now, you can't use named parameter queries easily from F# because the parameter handler looks for anonymous objects which F# doesn't support.

The code for detecting anonymous types just looks to see if the object has a namespace. You can do this from F# by declaring types in a module only file like

module Parameters

type ByName = {
    name : string
}

but this is not obvious nor optimal.

I have an Stackoverflow question about detecting F# record types from C# at runtime to see if we can maybe add a detection to Marten main. If that's not easy/possible we should consider alternatives.

@TheAngryByrd TheAngryByrd changed the title Figure out sql parameters Using F# Record types are named parameters Oct 6, 2017
@TheAngryByrd TheAngryByrd changed the title Using F# Record types are named parameters Using F# Record types as named parameters Oct 6, 2017
@baronfel
Copy link
Collaborator

I did a bit of research and this will work with the existing code (https://github.com/JasperFx/marten/blob/b752e79d473783651a763b18c2dc0f8c52d95816/src/Marten/Util/CommandExtensions.cs#L63) if we can just PR an extension to the detection code. Just have to do it via attribute inspection so as to not introduce the link to FSharp.Core

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

2 participants