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

Question: when quering jsonb, is it possible to define the properties in camcelcase ( JsonProperty, Column, something else)? #1279

Closed
andreas-soroko opened this issue Feb 19, 2020 · 1 comment

Comments

@andreas-soroko
Copy link

Hey,

imagine we have 2 models like

public class Model1 {
    public Guid Id {get; set;}
    //....
    [Column(TypeName = "jsonb")]
    public Model2 Data {get;set;}
}

public class Model2 {
    //....
    public string SomeField {get;set;}
}

and model2 gets serialized with camelcase settings

the following call

string someValue = "";
Model1.AsNoTracking().Where(s => s.Data.SomeField == someValue).ToListAsync();

creates the following query

SELECT u.id, u.data
      FROM model1 AS u
      WHERE u.data->>'SomeField' = @__someValue_0

but right would be

SELECT u.id, u.data
      FROM model1 AS u
      WHERE u.data->>'someField' = @__someValue_0

is there a way to tell the provider he should use camelcase ?
i tried jsonproperty ( from newtonsoft ) and also ColumnAttribute but booth gets ignored

@roji
Copy link
Member

roji commented Feb 20, 2020

Duplicate of #1107

@roji roji marked this as a duplicate of #1107 Feb 20, 2020
@roji roji closed this as completed Feb 20, 2020
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