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

How to use extended field query in EF query? #10662

Closed
feigaogit opened this issue Nov 18, 2021 · 1 comment
Closed

How to use extended field query in EF query? #10662

feigaogit opened this issue Nov 18, 2021 · 1 comment

Comments

@feigaogit
Copy link

image

@berkansasmaz
Copy link
Member

berkansasmaz commented Nov 18, 2021

If you're trying to do this for the ExtraProperties field in the database, you can't. Because the properties set in the ExtraProperties field are stored as a single JSON object.


However, you can refer to this document which explains the more natural way to do it.

If you have already mapped the property to ef core as stated in the document, you can use the query, below. Because the property you add is kept as a separate column in the database table.

var query = (await GetQueryableAsync()).Where(u => EF.Property<string>(u, "SocialSecurityNumber") == "123");

References:

  1. https://github.com/abpframework/abp/blob/dev/docs/en/Community-Articles/2021-05-24-Removing-EfCore-Migrations/POST.md#querying-based-on-a-custom-property
  2. https://github.com/abpframework/abp/blob/dev/docs/en/Community-Articles/2021-05-24-Removing-EfCore-Migrations/POST.md#mapping-to-the-database-table

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

3 participants