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

Check why we avoid parameterizing indexer method parameters in the funcletizer #34733

Open
roji opened this issue Sep 22, 2024 · 2 comments
Open

Comments

@roji
Copy link
Member

roji commented Sep 22, 2024

We have the following code in ExpressionTreeFuncletizer:

private bool IsParameterParameterizable(MethodInfo method, ParameterInfo parameter)
    => parameter.GetCustomAttribute<NotParameterizedAttribute>() is null
        && !_model.IsIndexerMethod(method);

... which means that we constantize arguments to what we identify as indexers (also not sure why the model needs to be involved in determining that something is an indexer...).

For example, this prevents parameters from being parameterized when using the PostgreSQL hstore type, which maps to Dictionary<string, string> (see npgsql/efcore.pg#3285 (comment)).

@yinzara
Copy link
Contributor

yinzara commented Oct 3, 2024

If this is the problem that's causing the issue with hstore, I'm curious, why is ImmutableDictionary not behaving the same way? They both are using an indexer property and it seems to be working correctly.

OOOOO you know what I'm betting it's because there is no set on an ImmutableDictionary's indexer property and for some reason that's making the difference.

@roji
Copy link
Member Author

roji commented Oct 7, 2024

@yinzara I don't think it's the absence of a setter, but there's some difference there which makes the funcletizer identify one and not the other... You can debug into the code I referenced above to find out.

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

No branches or pull requests

2 participants